Title: [244328] trunk
Revision
244328
Author
[email protected]
Date
2019-04-16 01:03:56 -0700 (Tue, 16 Apr 2019)

Log Message

[iOS] Redundant pointer events causes material design buttons to flush twice
https://bugs.webkit.org/show_bug.cgi?id=196914
<rdar://problem/49571860>

Reviewed by Dean Jackson.

Source/WebCore:

Test: pointerevents/ios/pointer-event-order.html

Do not dispatch pointer events for mouse events on iOS since we're already dispatching them when processing touch events.

* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent):

LayoutTests:

Add a new test that listens to all pointer event types as well as click, which forces the dispatch of compatibility mouse events
along with the click which would trigger duplicated pointer events prior to the source changes.

To ensure the new test added runs smoothly with a preceeding test that also uses ui.tap(), we add a delay to guarantee that no
double-taps are seen rather two successive single taps.

* pointerevents/ios/pointer-event-order-expected.txt: Added.
* pointerevents/ios/pointer-event-order.html: Added.
* pointerevents/utils.js:
(const.ui.new.UIController.prototype.tap):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244327 => 244328)


--- trunk/LayoutTests/ChangeLog	2019-04-16 06:57:16 UTC (rev 244327)
+++ trunk/LayoutTests/ChangeLog	2019-04-16 08:03:56 UTC (rev 244328)
@@ -1,3 +1,22 @@
+2019-04-15  Antoine Quint  <[email protected]>
+
+        [iOS] Redundant pointer events causes material design buttons to flush twice
+        https://bugs.webkit.org/show_bug.cgi?id=196914
+        <rdar://problem/49571860>
+
+        Reviewed by Dean Jackson.
+
+        Add a new test that listens to all pointer event types as well as click, which forces the dispatch of compatibility mouse events
+        along with the click which would trigger duplicated pointer events prior to the source changes.
+
+        To ensure the new test added runs smoothly with a preceeding test that also uses ui.tap(), we add a delay to guarantee that no
+        double-taps are seen rather two successive single taps.
+
+        * pointerevents/ios/pointer-event-order-expected.txt: Added.
+        * pointerevents/ios/pointer-event-order.html: Added.
+        * pointerevents/utils.js:
+        (const.ui.new.UIController.prototype.tap):
+
 2019-04-15  John Wilander  <[email protected]>
 
         Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness

Added: trunk/LayoutTests/pointerevents/ios/pointer-event-order-expected.txt (0 => 244328)


--- trunk/LayoutTests/pointerevents/ios/pointer-event-order-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-event-order-expected.txt	2019-04-16 08:03:56 UTC (rev 244328)
@@ -0,0 +1,3 @@
+
+PASS Testing the order in which pointer events are dispatched and that only one of each event is dispatched, even when a click event is registered. 
+

Added: trunk/LayoutTests/pointerevents/ios/pointer-event-order.html (0 => 244328)


--- trunk/LayoutTests/pointerevents/ios/pointer-event-order.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-event-order.html	2019-04-16 08:03:56 UTC (rev 244328)
@@ -0,0 +1,34 @@
+<!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({ width: "200px", height: "200px" }, (target, test) => {
+    const eventTracker = new EventTracker(target, ["pointerdown", "pointerenter", "pointerleave", "pointermove", "pointerout", "pointerover", "pointerup", "click"]);
+
+    ui.tap({ x: 100, y: 100 }).then(() => {
+        eventTracker.assertMatchesEvents([
+            { type: "pointerover", x: 100, y: 100, isPrimary: true },
+            { type: "pointerenter", x: 100, y: 100, isPrimary: true },
+            { type: "pointerdown", x: 100, y: 100, isPrimary: true },
+            { type: "pointerup", x: 100, y: 100, isPrimary: false },
+            { type: "pointerout", x: 100, y: 100, isPrimary: false },
+            { type: "pointerleave", x: 100, y: 100, isPrimary: false },
+            { type: "click", x: 100, y: 100 },
+        ]);
+        test.done();
+    });
+}, `Testing the order in which pointer events are dispatched and that only one of each event is dispatched, even when a click event is registered.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/pointerevents/utils.js (244327 => 244328)


--- trunk/LayoutTests/pointerevents/utils.js	2019-04-16 06:57:16 UTC (rev 244327)
+++ trunk/LayoutTests/pointerevents/utils.js	2019-04-16 08:03:56 UTC (rev 244328)
@@ -120,7 +120,11 @@
 
     tap(options)
     {
-        return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
+        // Add a delay to ensure sequence of tap() calls don't yield double taps.
+        const delay = 1000;
+        return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`).then(() => {
+            return new Promise(resolve => setTimeout(resolve, delay));
+        });
     }
 
     pinchOut(options)

Modified: trunk/Source/WebCore/ChangeLog (244327 => 244328)


--- trunk/Source/WebCore/ChangeLog	2019-04-16 06:57:16 UTC (rev 244327)
+++ trunk/Source/WebCore/ChangeLog	2019-04-16 08:03:56 UTC (rev 244328)
@@ -1,3 +1,18 @@
+2019-04-15  Antoine Quint  <[email protected]>
+
+        [iOS] Redundant pointer events causes material design buttons to flush twice
+        https://bugs.webkit.org/show_bug.cgi?id=196914
+        <rdar://problem/49571860>
+
+        Reviewed by Dean Jackson.
+
+        Test: pointerevents/ios/pointer-event-order.html
+
+        Do not dispatch pointer events for mouse events on iOS since we're already dispatching them when processing touch events.
+
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchMouseEvent):
+
 2019-04-15  John Wilander  <[email protected]>
 
         Add a query string nonce to LayoutTests/http/tests/adClickAttribution/send-attribution-conversion-request.html to address flakiness

Modified: trunk/Source/WebCore/dom/Element.cpp (244327 => 244328)


--- trunk/Source/WebCore/dom/Element.cpp	2019-04-16 06:57:16 UTC (rev 244327)
+++ trunk/Source/WebCore/dom/Element.cpp	2019-04-16 08:03:56 UTC (rev 244328)
@@ -302,7 +302,7 @@
 
     bool didNotSwallowEvent = true;
 
-#if ENABLE(POINTER_EVENTS)
+#if ENABLE(POINTER_EVENTS) && !ENABLE(TOUCH_EVENTS)
     if (RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled()) {
         if (auto pointerEvent = PointerEvent::create(mouseEvent)) {
             if (auto* page = document().page())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to