Title: [265213] trunk
Revision
265213
Author
wenson_hs...@apple.com
Date
2020-08-03 13:40:30 -0700 (Mon, 03 Aug 2020)

Log Message

[iOS 14] editing/selection/ios/select-all-non-editable-text-using-keyboard.html sometimes times out
https://bugs.webkit.org/show_bug.cgi?id=215089
<rdar://problem/66282806>

Reviewed by Tim Horton.

Source/WebKit:

* Platform/spi/ios/UIKitSPI.h:

Tools:

Add some logging to try and diagnose this flaky test failure. The timeout only happens on iOS 14, and also does
not reproduce on my local machine. This patch tests a couple of hypotheses which may explain why the test times
out:

-   The test may be starting in a state where the content view is not first responder, or the view's window is
    not the key window.

-   Synthesizing the modifier keydown HID event may be failing to change the live modifier flags on the
    application's `GSKeyboardRef` (e.g. the issue that was fixed in <https://trac.webkit.org/r264907>).

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::keyDown):
* WebKitTestRunner/ios/mainIOS.mm:
(-[WebKitTestRunnerApp handleKeyHIDEvent:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (265212 => 265213)


--- trunk/Source/WebKit/ChangeLog	2020-08-03 20:38:19 UTC (rev 265212)
+++ trunk/Source/WebKit/ChangeLog	2020-08-03 20:40:30 UTC (rev 265213)
@@ -1,3 +1,13 @@
+2020-08-03  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iOS 14] editing/selection/ios/select-all-non-editable-text-using-keyboard.html sometimes times out
+        https://bugs.webkit.org/show_bug.cgi?id=215089
+        <rdar://problem/66282806>
+
+        Reviewed by Tim Horton.
+
+        * Platform/spi/ios/UIKitSPI.h:
+
 2020-08-03  Devin Rousso  <drou...@apple.com>
 
         should be able to request an editing context for a given region of a given input

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (265212 => 265213)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-08-03 20:38:19 UTC (rev 265212)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-08-03 20:40:30 UTC (rev 265213)
@@ -195,6 +195,7 @@
 - (void)_enqueueHIDEvent:(IOHIDEventRef)event;
 - (void)_handleHIDEvent:(IOHIDEventRef)event;
 - (void)handleKeyUIEvent:(UIEvent *)event;
+- (void)handleKeyHIDEvent:(IOHIDEventRef)event;
 - (BOOL)_appAdoptsUISceneLifecycle;
 @end
 
@@ -1239,6 +1240,10 @@
 - (void)didEndScrollingOrZooming;
 @end
 
+@interface UIApplication (IPI)
+- (GSKeyboardRef)_hardwareKeyboard:(BOOL)createIfNeeded;
+@end
+
 @interface UITextInteraction (IPI)
 @property (nonatomic, readonly) BOOL inGesture;
 @end

Modified: trunk/Tools/ChangeLog (265212 => 265213)


--- trunk/Tools/ChangeLog	2020-08-03 20:38:19 UTC (rev 265212)
+++ trunk/Tools/ChangeLog	2020-08-03 20:40:30 UTC (rev 265213)
@@ -1,3 +1,26 @@
+2020-08-03  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iOS 14] editing/selection/ios/select-all-non-editable-text-using-keyboard.html sometimes times out
+        https://bugs.webkit.org/show_bug.cgi?id=215089
+        <rdar://problem/66282806>
+
+        Reviewed by Tim Horton.
+
+        Add some logging to try and diagnose this flaky test failure. The timeout only happens on iOS 14, and also does
+        not reproduce on my local machine. This patch tests a couple of hypotheses which may explain why the test times
+        out:
+
+        -   The test may be starting in a state where the content view is not first responder, or the view's window is
+            not the key window.
+
+        -   Synthesizing the modifier keydown HID event may be failing to change the live modifier flags on the
+            application's `GSKeyboardRef` (e.g. the issue that was fixed in <https://trac.webkit.org/r264907>).
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptControllerIOS::keyDown):
+        * WebKitTestRunner/ios/mainIOS.mm:
+        (-[WebKitTestRunnerApp handleKeyHIDEvent:]):
+
 2020-08-03  Aakash Jain  <aakash_j...@apple.com>
 
         Disable gtk-wk2 queue temporarily

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (265212 => 265213)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-08-03 20:38:19 UTC (rev 265212)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-08-03 20:40:30 UTC (rev 265213)
@@ -554,15 +554,21 @@
     String inputString = toWTFString(toWK(character));
     auto modifierFlags = parseModifierArray(m_context->jsContext(), modifierArray);
 
-    for (auto& modifierFlag : modifierFlags)
+    WTFLogAlways("Synthesizing key events (first responder: %@; is key window? %d)", webView().firstResponder.class, webView().window.keyWindow);
+    for (auto& modifierFlag : modifierFlags) {
+        WTFLogAlways("Sending modifier keydown: %s", modifierFlag.utf8().data());
         [[HIDEventGenerator sharedHIDEventGenerator] keyDown:modifierFlag];
+    }
 
+    WTFLogAlways("Sending keydown for input string '%s'", inputString.utf8().data());
     [[HIDEventGenerator sharedHIDEventGenerator] keyDown:inputString];
+    WTFLogAlways("Sending keyup for input string '%s'", inputString.utf8().data());
     [[HIDEventGenerator sharedHIDEventGenerator] keyUp:inputString];
 
     for (size_t i = modifierFlags.size(); i; ) {
         --i;
         [[HIDEventGenerator sharedHIDEventGenerator] keyUp:modifierFlags[i]];
+        WTFLogAlways("Sending modifier keyup: %s", modifierFlags[i].utf8().data());
     }
 
     [[HIDEventGenerator sharedHIDEventGenerator] sendMarkerHIDEventWithCompletionBlock:^{ /* Do nothing */ }];

Modified: trunk/Tools/WebKitTestRunner/ios/mainIOS.mm (265212 => 265213)


--- trunk/Tools/WebKitTestRunner/ios/mainIOS.mm	2020-08-03 20:38:19 UTC (rev 265212)
+++ trunk/Tools/WebKitTestRunner/ios/mainIOS.mm	2020-08-03 20:40:30 UTC (rev 265213)
@@ -28,6 +28,7 @@
 #import "HIDEventGenerator.h"
 #import "TestController.h"
 #import "UIKitSPI.h"
+#import <pal/spi/ios/GraphicsServicesSPI.h>
 
 static int _argc;
 static const char **_argv;
@@ -61,6 +62,19 @@
     [[HIDEventGenerator sharedHIDEventGenerator] markerEventReceived:event];
 }
 
+- (void)handleKeyHIDEvent:(IOHIDEventRef)event
+{
+    {
+        auto keyboard = [self _hardwareKeyboard:NO];
+        WTFLogAlways("(Before)  keyboard %p has modifier state: 0x%02x", keyboard, GSKeyboardGetModifierState(keyboard));
+    }
+    [super handleKeyHIDEvent:event];
+    {
+        auto keyboard = [self _hardwareKeyboard:NO];
+        WTFLogAlways("(After)   keyboard %p has modifier state: 0x%02x", keyboard, GSKeyboardGetModifierState(keyboard));
+    }
+}
+
 @end
 
 int main(int argc, const char* argv[])
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to