Title: [264890] trunk/Tools
Revision
264890
Author
[email protected]
Date
2020-07-25 13:02:23 -0700 (Sat, 25 Jul 2020)

Log Message

REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=214688
<rdar://problem/65993683>

Reviewed by Tim Horton.

Attempt a second speculative fix that waits for the keydown HID event to be dequeued and handled by
`UIApplication` when simulating a shift-tap, to guarantee that the synthetic click gesture recognizer has
up-to-date modifier flags upon dispatching the synthetic HID events on tap.

It's unclear how or why the current implementation might result in the gesture recognizer not being updated with
the right modifier flags, since events in the HID event queue should be handled in order.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::singleTapAtPointWithModifiers):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (264889 => 264890)


--- trunk/Tools/ChangeLog	2020-07-25 19:48:56 UTC (rev 264889)
+++ trunk/Tools/ChangeLog	2020-07-25 20:02:23 UTC (rev 264890)
@@ -1,3 +1,21 @@
+2020-07-25  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=214688
+        <rdar://problem/65993683>
+
+        Reviewed by Tim Horton.
+
+        Attempt a second speculative fix that waits for the keydown HID event to be dequeued and handled by
+        `UIApplication` when simulating a shift-tap, to guarantee that the synthetic click gesture recognizer has
+        up-to-date modifier flags upon dispatching the synthetic HID events on tap.
+
+        It's unclear how or why the current implementation might result in the gesture recognizer not being updated with
+        the right modifier flags, since events in the HID event queue should be handled in order.
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptControllerIOS::singleTapAtPointWithModifiers):
+
 2020-07-24  Wenson Hsieh  <[email protected]>
 
         REGRESSION (r264690): [ iOS wk2 ] editing/selection/shift-click-includes-existing-selection.html is a flaky failure

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (264889 => 264890)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-07-25 19:48:56 UTC (rev 264889)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-07-25 20:02:23 UTC (rev 264890)
@@ -301,23 +301,34 @@
     waitForSingleTapToReset();
 
     if (!modifierFlags.isEmpty())
-        WTFLogAlways("Synthesizing modifier key events.");
+        WTFLogAlways("Synthesizing modifier keydown events.");
 
     for (auto& modifierFlag : modifierFlags)
         [[HIDEventGenerator sharedHIDEventGenerator] keyDown:modifierFlag];
 
-    if (!modifierFlags.isEmpty())
-        WTFLogAlways("Synthesizing tap.");
+    auto dispatchTap = [this, protectedThis = makeRef(*this), modifierFlags = WTFMove(modifierFlags), block = WTFMove(block), location]() mutable {
+        if (!modifierFlags.isEmpty())
+            WTFLogAlways("Synthesizing tap.");
 
-    [[HIDEventGenerator sharedHIDEventGenerator] tap:globalToContentCoordinates(webView(), location.x(), location.y()) completionBlock:[this, protectedThis = makeRefPtr(*this), modifierFlags = WTFMove(modifierFlags), block = WTFMove(block)] () mutable {
-        if (!m_context)
-            return;
-        for (size_t i = modifierFlags.size(); i; ) {
-            --i;
-            [[HIDEventGenerator sharedHIDEventGenerator] keyUp:modifierFlags[i]];
-        }
-        [[HIDEventGenerator sharedHIDEventGenerator] sendMarkerHIDEventWithCompletionBlock:block.get()];
-    }];
+        [[HIDEventGenerator sharedHIDEventGenerator] tap:globalToContentCoordinates(webView(), location.x(), location.y()) completionBlock:[protectedThis, modifierFlags = WTFMove(modifierFlags), block = WTFMove(block)] () mutable {
+            if (!protectedThis->m_context)
+                return;
+
+            if (!modifierFlags.isEmpty())
+                WTFLogAlways("Synthesizing modifier keyup events.");
+
+            for (size_t i = modifierFlags.size(); i; ) {
+                --i;
+                [[HIDEventGenerator sharedHIDEventGenerator] keyUp:modifierFlags[i]];
+            }
+            [[HIDEventGenerator sharedHIDEventGenerator] sendMarkerHIDEventWithCompletionBlock:block.get()];
+        }];
+    };
+
+    if (modifierFlags.isEmpty())
+        dispatchTap();
+    else
+        [[HIDEventGenerator sharedHIDEventGenerator] sendMarkerHIDEventWithCompletionBlock:dispatchTap];
 }
 
 void UIScriptControllerIOS::doubleTapAtPoint(long x, long y, float delay, JSValueRef callback)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to