Title: [291572] trunk/Source/WebCore
Revision
291572
Author
grao...@webkit.org
Date
2022-03-21 12:00:18 -0700 (Mon, 21 Mar 2022)

Log Message

[media-controls] tap gesture recognizer sometimes fails to recognize on iOS
https://bugs.webkit.org/show_bug.cgi?id=238136

Reviewed by Dean Jackson.

While on macOS it's fine to register pointer events handlers on the `window` object,
on iOS it may not be depending on the fullscreen state. However, it's always fine to
use the gesture recognizer's target on iOS, so let's default to that when touches
are supported.

* Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
(GestureRecognizer.prototype.touchesBegan):
(GestureRecognizer.prototype.get _captureTarget):
(GestureRecognizer.prototype._removeTrackingListeners):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291571 => 291572)


--- trunk/Source/WebCore/ChangeLog	2022-03-21 18:58:31 UTC (rev 291571)
+++ trunk/Source/WebCore/ChangeLog	2022-03-21 19:00:18 UTC (rev 291572)
@@ -1,3 +1,20 @@
+2022-03-21  Antoine Quint  <grao...@webkit.org>
+
+        [media-controls] tap gesture recognizer sometimes fails to recognize on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=238136
+
+        Reviewed by Dean Jackson.
+
+        While on macOS it's fine to register pointer events handlers on the `window` object,
+        on iOS it may not be depending on the fullscreen state. However, it's always fine to
+        use the gesture recognizer's target on iOS, so let's default to that when touches
+        are supported.
+
+        * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
+        (GestureRecognizer.prototype.touchesBegan):
+        (GestureRecognizer.prototype.get _captureTarget):
+        (GestureRecognizer.prototype._removeTrackingListeners):
+
 2022-03-21  Tyler Wilcock  <tyle...@apple.com>
 
         AX: Include display: contents elements in the AX tree

Modified: trunk/Source/WebCore/Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js (291571 => 291572)


--- trunk/Source/WebCore/Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js	2022-03-21 18:58:31 UTC (rev 291571)
+++ trunk/Source/WebCore/Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js	2022-03-21 19:00:18 UTC (rev 291572)
@@ -125,9 +125,9 @@
         if (event.currentTarget !== this._target)
             return;
 
-        window.addEventListener(GestureRecognizer.Events.PointerMove, this, true);
-        window.addEventListener(GestureRecognizer.Events.PointerUp, this, true);
-        window.addEventListener(GestureRecognizer.Events.PointerCancel, this, true);
+        this._captureTarget.addEventListener(GestureRecognizer.Events.PointerMove, this, true);
+        this._captureTarget.addEventListener(GestureRecognizer.Events.PointerUp, this, true);
+        this._captureTarget.addEventListener(GestureRecognizer.Events.PointerCancel, this, true);
         this.enterPossibleState();
     }
 
@@ -269,11 +269,18 @@
         }
     }
 
+    get _captureTarget()
+    {
+        if (GestureRecognizer.SupportsTouches)
+            return this._target;
+        return window;
+    }
+
     _removeTrackingListeners()
     {
-        window.removeEventListener(GestureRecognizer.Events.PointerMove, this, true);
-        window.removeEventListener(GestureRecognizer.Events.PointerUp, this, true);
-        window.removeEventListener(GestureRecognizer.Events.PointerCancel, this, true);
+        this._captureTarget.removeEventListener(GestureRecognizer.Events.PointerMove, this, true);
+        this._captureTarget.removeEventListener(GestureRecognizer.Events.PointerUp, this, true);
+        this._captureTarget.removeEventListener(GestureRecognizer.Events.PointerCancel, this, true);
         this._target.removeEventListener(GestureRecognizer.Events.GestureChange, this, true);
         this._target.removeEventListener(GestureRecognizer.Events.GestureEnd, this, true);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to