Title: [255786] trunk
Revision
255786
Author
[email protected]
Date
2020-02-04 20:32:18 -0800 (Tue, 04 Feb 2020)

Log Message

REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com
https://bugs.webkit.org/show_bug.cgi?id=207239
<rdar://problem/58686015>

Reviewed by Tim Horton.

Source/WebKit:

Following r251320, all synthetic mouse events on iOS additionally dispatched corresponding pointer events. This
led to duplicate "pointerdown"/"pointerup" events dispatched with every tap. r253878 fixed this by avoiding
pointer event dispatch for synthetically generated mouse events (and made this determination by consulting
`syntheticClickType()`).

However, in the case where we're synthesizing a mouse event for a "dblclick" event handler (after a double-
tap), we currently pass `NoTap` as the synthetic click event type when creating the mouse event. This causes
additional pointer events to be synthesized and dispatched during a double tap, which creates three pairs of
"pointerdown"/"pointerup" events upon double-tap. This subsequently confuses iCloud Notes' web app when double
tapping to select a word.

Fix this by passing in `OneFingerTap` as the synthetic click type instead (since two-finger double taps should
already be handled by the two-finger double-tap magnification gesture).

Test: pointerevents/ios/pointer-events-for-double-tap.html

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):

LayoutTests:

Add a test to verify that performing a double tap on an element with a dblclick handler results in the following
sequence of events: `[ "pointerdown", "pointerup", "pointerdown", "pointerup", "dblclick" ]`.

* pointerevents/ios/pointer-events-for-double-tap-expected.txt: Added.
* pointerevents/ios/pointer-events-for-double-tap.html: Added.
* pointerevents/utils.js:
(const.ui.new.UIController.prototype.doubleTap):

Add a helper method to simulate a double-tap gesture.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (255785 => 255786)


--- trunk/LayoutTests/ChangeLog	2020-02-05 03:47:15 UTC (rev 255785)
+++ trunk/LayoutTests/ChangeLog	2020-02-05 04:32:18 UTC (rev 255786)
@@ -1,3 +1,21 @@
+2020-02-04  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com
+        https://bugs.webkit.org/show_bug.cgi?id=207239
+        <rdar://problem/58686015>
+
+        Reviewed by Tim Horton.
+
+        Add a test to verify that performing a double tap on an element with a dblclick handler results in the following
+        sequence of events: `[ "pointerdown", "pointerup", "pointerdown", "pointerup", "dblclick" ]`.
+
+        * pointerevents/ios/pointer-events-for-double-tap-expected.txt: Added.
+        * pointerevents/ios/pointer-events-for-double-tap.html: Added.
+        * pointerevents/utils.js:
+        (const.ui.new.UIController.prototype.doubleTap):
+
+        Add a helper method to simulate a double-tap gesture.
+
 2020-02-04  Ryan Haddad  <[email protected]>
 
         REGRESSION [ Mac wk2 ] Tests are jetsamming: Unable to shrink memory footprint of process below the kill thresold [sic]

Added: trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap-expected.txt (0 => 255786)


--- trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap-expected.txt	2020-02-05 04:32:18 UTC (rev 255786)
@@ -0,0 +1,3 @@
+
+PASS Verifies that two pairs of pointerup and pointerdown events are dispatched in an element with a dblclick event handler. 
+

Added: trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap.html (0 => 255786)


--- trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-events-for-double-tap.html	2020-02-05 04:32:18 UTC (rev 255786)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+'use strict';
+
+target_test((target, test) => {
+    const eventTracker = new EventTracker(target, ["pointerdown", "pointerup", "dblclick"]);
+    ui.doubleTap({ x: 50, y: 50 }).then(() => {
+        eventTracker.assertMatchesEvents([
+            { type: "pointerdown" },
+            { type: "pointerup" },
+            { type: "pointerdown" },
+            { type: "pointerup" },
+            { type: "dblclick" }
+        ]);
+        test.done();
+    });
+}, "Verifies that two pairs of pointerup and pointerdown events are dispatched in an element with a dblclick event handler.");
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/pointerevents/utils.js (255785 => 255786)


--- trunk/LayoutTests/pointerevents/utils.js	2020-02-05 03:47:15 UTC (rev 255785)
+++ trunk/LayoutTests/pointerevents/utils.js	2020-02-05 04:32:18 UTC (rev 255786)
@@ -134,6 +134,11 @@
         return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
     }
 
+    doubleTap(options)
+    {
+        return this._run(`uiController.doubleTapAtPoint(${options.x}, ${options.y}, 0, () => uiController.uiScriptComplete())`);
+    }
+
     doubleTapToZoom(options)
     {
         const durationInSeconds = 0.35;

Modified: trunk/Source/WebKit/ChangeLog (255785 => 255786)


--- trunk/Source/WebKit/ChangeLog	2020-02-05 03:47:15 UTC (rev 255785)
+++ trunk/Source/WebKit/ChangeLog	2020-02-05 04:32:18 UTC (rev 255786)
@@ -1,3 +1,30 @@
+2020-02-04  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r251320): Can't double tap to select word in Notes on iCloud.com
+        https://bugs.webkit.org/show_bug.cgi?id=207239
+        <rdar://problem/58686015>
+
+        Reviewed by Tim Horton.
+
+        Following r251320, all synthetic mouse events on iOS additionally dispatched corresponding pointer events. This
+        led to duplicate "pointerdown"/"pointerup" events dispatched with every tap. r253878 fixed this by avoiding
+        pointer event dispatch for synthetically generated mouse events (and made this determination by consulting
+        `syntheticClickType()`).
+
+        However, in the case where we're synthesizing a mouse event for a "dblclick" event handler (after a double-
+        tap), we currently pass `NoTap` as the synthetic click event type when creating the mouse event. This causes
+        additional pointer events to be synthesized and dispatched during a double tap, which creates three pairs of
+        "pointerdown"/"pointerup" events upon double-tap. This subsequently confuses iCloud Notes' web app when double
+        tapping to select a word.
+
+        Fix this by passing in `OneFingerTap` as the synthetic click type instead (since two-finger double taps should
+        already be handled by the two-finger double-tap magnification gesture).
+
+        Test: pointerevents/ios/pointer-events-for-double-tap.html
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
+
 2020-02-01  Darin Adler  <[email protected]>
 
         Replace RGBA32 typedef with a class to improve type safety

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (255785 => 255786)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-05 03:47:15 UTC (rev 255785)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-05 04:32:18 UTC (rev 255786)
@@ -833,10 +833,10 @@
     bool altKey = modifiers.contains(WebEvent::Modifier::AltKey);
     bool metaKey = modifiers.contains(WebEvent::Modifier::MetaKey);
     auto roundedAdjustedPoint = roundedIntPoint(adjustedPoint);
-    nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
+    nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::OneFingerTap));
     if (m_isClosed)
         return;
-    nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
+    nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::OneFingerTap));
 }
 
 void WebPage::requestFocusedElementInformation(WebKit::CallbackID callbackID)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to