Title: [245268] trunk
Revision
245268
Author
[email protected]
Date
2019-05-13 19:25:34 -0700 (Mon, 13 May 2019)

Log Message

[iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
https://bugs.webkit.org/show_bug.cgi?id=197821
<rdar://problem/50700512>

Reviewed by Tim Horton.

Source/WebKit:

After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double
tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture
recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize,
unless the element with the click handler is also accompanied by a dblclick handler.

To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of
making it such that the second page doesn't end up observing a dblclick when the first click was only sent to
the first page.

* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView _didStartProvisionalLoadForMainFrame]):

LayoutTests:

Removes workarounds in a couple of existing layout tests.

* editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html:
* editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245267 => 245268)


--- trunk/LayoutTests/ChangeLog	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/LayoutTests/ChangeLog	2019-05-14 02:25:34 UTC (rev 245268)
@@ -1,3 +1,16 @@
+2019-05-13  Wenson Hsieh  <[email protected]>
+
+        [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
+        https://bugs.webkit.org/show_bug.cgi?id=197821
+        <rdar://problem/50700512>
+
+        Reviewed by Tim Horton.
+
+        Removes workarounds in a couple of existing layout tests.
+
+        * editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html:
+        * editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html:
+
 2019-05-13  Jiewen Tan  <[email protected]>
 
         [WebAuthN] InvalidStateError should be reported to sites

Modified: trunk/LayoutTests/editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html (245267 => 245268)


--- trunk/LayoutTests/editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/LayoutTests/editing/selection/ios/clear-selection-after-tapping-on-element-with-no-click-handler.html	2019-05-14 02:25:34 UTC (rev 245268)
@@ -42,15 +42,7 @@
         window.getSelection().setBaseAndExtent(target, 0, target, 6);
 
         await UIHelper.activateElement(clickTarget);
-
-        setTimeout(async function () {
-            // The test is done, but we need to tap again to ensure we don't
-            // hang the next test with a double tap.
-            document.removeEventListener("selectionchange", didChangeSelection);
-            await UIHelper.tapAt(10, 500);
-
-            testRunner.notifyDone();
-        }, 0);
+        setTimeout(() => testRunner.notifyDone(), 0);
     }
     </script>
 </head>

Modified: trunk/LayoutTests/editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html (245267 => 245268)


--- trunk/LayoutTests/editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/LayoutTests/editing/selection/ios/persist-selection-after-tapping-on-element-with-click-handler.html	2019-05-14 02:25:34 UTC (rev 245268)
@@ -41,15 +41,7 @@
 
         clickTarget.addEventListener("click", event => {
             event.preventDefault();
-
-            setTimeout(async function () {
-                // The test is done, but we need to tap again to ensure we don't
-                // hang the next test with a double tap.
-                document.removeEventListener("selectionchange", didChangeSelection);
-                await UIHelper.tapAt(10, 500);
-
-                testRunner.notifyDone();
-            }, 0);
+            setTimeout(() => testRunner.notifyDone(), 0);
         });
 
         var target = document.getElementById("target");        

Modified: trunk/Source/WebKit/ChangeLog (245267 => 245268)


--- trunk/Source/WebKit/ChangeLog	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/Source/WebKit/ChangeLog	2019-05-14 02:25:34 UTC (rev 245268)
@@ -1,5 +1,29 @@
 2019-05-13  Wenson Hsieh  <[email protected]>
 
+        [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
+        https://bugs.webkit.org/show_bug.cgi?id=197821
+        <rdar://problem/50700512>
+
+        Reviewed by Tim Horton.
+
+        After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double
+        tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture
+        recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize,
+        unless the element with the click handler is also accompanied by a dblclick handler.
+
+        To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of
+        making it such that the second page doesn't end up observing a dblclick when the first click was only sent to
+        the first page.
+
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        (-[WKContentView _didStartProvisionalLoadForMainFrame]):
+
+2019-05-13  Wenson Hsieh  <[email protected]>
+
         Unreviewed, fix some deprecation warnings when using a recent SDK
 
         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (245267 => 245268)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-05-14 02:25:34 UTC (rev 245268)
@@ -215,6 +215,7 @@
 void PageClientImpl::didStartProvisionalLoadForMainFrame()
 {
     [m_webView _didStartProvisionalLoadForMainFrame];
+    [m_contentView _didStartProvisionalLoadForMainFrame];
     [m_webView _hidePasswordView];
 }
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (245267 => 245268)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-05-14 02:25:34 UTC (rev 245268)
@@ -506,6 +506,8 @@
 
 - (void)_handleAutocorrectionContext:(const WebKit::WebAutocorrectionContext&)context;
 
+- (void)_didStartProvisionalLoadForMainFrame;
+
 @end
 
 @interface WKContentView (WKTesting)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245267 => 245268)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-14 00:12:07 UTC (rev 245267)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-14 02:25:34 UTC (rev 245268)
@@ -738,7 +738,6 @@
     _doubleTapGestureRecognizerForDoubleClick = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognizedForDoubleClick:)]);
     [_doubleTapGestureRecognizerForDoubleClick setNumberOfTapsRequired:2];
     [_doubleTapGestureRecognizerForDoubleClick setDelegate:self];
-    [_doubleTapGestureRecognizerForDoubleClick setEnabled:YES];
     [self addGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
 
     [self _createAndConfigureDoubleTapGestureRecognizer];
@@ -3762,6 +3761,13 @@
     [self _invokePendingAutocorrectionContextHandler:[WKAutocorrectionContext autocorrectionContextWithWebContext:context]];
 }
 
+- (void)_didStartProvisionalLoadForMainFrame
+{
+    // Reset the double tap gesture recognizer to prevent any double click that is in the process of being recognized.
+    [_doubleTapGestureRecognizerForDoubleClick setEnabled:NO];
+    [_doubleTapGestureRecognizerForDoubleClick setEnabled:YES];
+}
+
 #if !USE(UIKIT_KEYBOARD_ADDITIONS)
 - (NSArray *)keyCommands
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to