Title: [246213] trunk
Revision
246213
Author
grao...@webkit.org
Date
2019-06-07 13:55:45 -0700 (Fri, 07 Jun 2019)

Log Message

Restrict fast clicks everywhere to desktop content mode
https://bugs.webkit.org/show_bug.cgi?id=198610
<rdar://problem/50114230>

Reviewed by Dean Jackson.

Source/WebKit:

We now set a new allowsFastClicksEverywhere property on the WebPageProxy when the content mode changes, set to true
when we're in desktop browsing mode. We now check on this property to opt into the fast clicks everywhere behavior.

This patch had been reverted once because it yielded some regressions in existing tests, notably under
fast/events/touch/ios/content-observation. This updated patch addresses this by ensuring the gesture recognizers
used for double-tap-to-zoom are disabled in -[WKContentViewInteraction _didStartProvisionalLoadForMainFrame]
to ensure that two tests dispatching a tap at the same location don't yield the recognition of a double-tap
rathern than the recognition of two single taps.

* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::allowsFastClicksEverywhere const):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
(_didStartProvisionalLoadForMainFrame):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):

LayoutTests:

Add a new test that enables fast clicks but also sets a mobile content mode.

We also mark fast/visual-viewport/ios/min-scale-greater-than-one.html as non-flaky
since the flakiness was due to the fast clicks everywhere behavior being enabled on iPhone.

Finally, we can now remove the hack where ui.tap() in the Pointer Events utility returned
a promise with a one-second delay since the issue of double-taps being recognized instead of
two consecutive single taps across two tests has been resolved.

* fast/events/ios/ipad/fast-click-always-mobile-content-mode-expected.txt: Added.
* fast/events/ios/ipad/fast-click-always-mobile-content-mode.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* pointerevents/utils.js:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246212 => 246213)


--- trunk/LayoutTests/ChangeLog	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/LayoutTests/ChangeLog	2019-06-07 20:55:45 UTC (rev 246213)
@@ -1,3 +1,25 @@
+2019-06-07  Antoine Quint  <grao...@apple.com>
+
+        Restrict fast clicks everywhere to desktop content mode
+        https://bugs.webkit.org/show_bug.cgi?id=198610
+        <rdar://problem/50114230>
+
+        Reviewed by Dean Jackson.
+
+        Add a new test that enables fast clicks but also sets a mobile content mode.
+        
+        We also mark fast/visual-viewport/ios/min-scale-greater-than-one.html as non-flaky
+        since the flakiness was due to the fast clicks everywhere behavior being enabled on iPhone.
+
+        Finally, we can now remove the hack where ui.tap() in the Pointer Events utility returned
+        a promise with a one-second delay since the issue of double-taps being recognized instead of
+        two consecutive single taps across two tests has been resolved.
+
+        * fast/events/ios/ipad/fast-click-always-mobile-content-mode-expected.txt: Added.
+        * fast/events/ios/ipad/fast-click-always-mobile-content-mode.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+        * pointerevents/utils.js:
+
 2019-06-07  Shawn Roberts  <srobe...@apple.com>
 
         http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html is a flaky timeout

Added: trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode-expected.txt (0 => 246213)


--- trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode-expected.txt	2019-06-07 20:55:45 UTC (rev 246213)
@@ -0,0 +1,2 @@
+PASS: Double tap caused zoom.
+This document doesn't have fast clicks because it sets a viewport width. It has a significant zoom since the viewport width is significantly bigger than the body width. However, although fast click everywhere is set to false, the content mode is also set to mobile which disables fast click everywhere, so double tapping on the rectangle above should zoom.

Added: trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode.html (0 => 246213)


--- trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/ipad/fast-click-always-mobile-content-mode.html	2019-06-07 20:55:45 UTC (rev 246213)
@@ -0,0 +1,59 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true contentMode=mobile internal:FastClicksEverywhere=true ] -->
+
+<html>
+<meta name="viewport" content="width=800">
+<head>
+    <style>
+        body {
+            font-family: system-ui;
+            line-height: 1.4;
+            padding: 10px 10px;
+            width: 500px;
+            margin: 0;
+        }
+    </style>
+    <script src=""
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        async function runTest()
+        {
+            document.getElementById("target").addEventListener("click", handleClick, false);
+
+            if (!window.testRunner)
+                return;
+
+            await UIHelper.humanSpeedZoomByDoubleTappingAt(30, 30);
+            document.getElementById("target").textContent = "PASS: Double tap caused zoom.";
+            testRunner.notifyDone();
+        }
+
+        function handleClick(event)
+        {
+            document.getElementById("target").textContent = "FAIL: Click fired on element with handler.";
+            testRunner.notifyDone();
+        }
+    </script>
+    <style>
+        body {
+            margin: 0;
+        }
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    </style>
+</head>
+<body _onload_="runTest()">
+<div id="target"></div>
+<div id="description">This document doesn't have fast clicks because
+    it sets a viewport width. It has a significant zoom since the viewport
+    width is significantly bigger than the body width. However, although fast click
+    everywhere is set to false, the content mode is also set to mobile which disables
+    fast click everywhere, so double tapping on the rectangle above should zoom.</div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (246212 => 246213)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2019-06-07 20:55:45 UTC (rev 246213)
@@ -52,8 +52,6 @@
 
 webkit.org/b/196233 fast/viewport/ios/initial-scale-after-changing-view-scale.html [ Pass Timeout ]
 
-webkit.org/b/196236 [ Debug ] fast/visual-viewport/ios/min-scale-greater-than-one.html [ Pass Failure ]
-
 webkit.org/b/196269 http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html [ Pass Timeout ]
 webkit.org/b/196269 http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html [ Pass Timeout ]
 webkit.org/b/196269 http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html [ Pass Timeout ]
@@ -63,8 +61,6 @@
 webkit.org/b/191709 editing/deleting/delete-emoji-9.html [ Pass Failure ]
 webkit.org/b/191709 editing/deleting/delete-emoji.html [ Pass Failure ]
 
-webkit.org/b/196300 fast/visual-viewport/ios/min-scale-greater-than-one.html [ Pass Failure ]
-
 webkit.org/b/196298 fast/viewport/ios/use-minimum-device-width-for-page-without-viewport-meta.html [ Pass Failure ]
 
 webkit.org/b/162975 http/tests/cache/disk-cache/memory-cache-revalidation-updates-disk-cache.html [ Pass Failure ]

Modified: trunk/LayoutTests/pointerevents/utils.js (246212 => 246213)


--- trunk/LayoutTests/pointerevents/utils.js	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/LayoutTests/pointerevents/utils.js	2019-06-07 20:55:45 UTC (rev 246213)
@@ -118,11 +118,7 @@
 
     tap(options)
     {
-        // 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));
-        });
+        return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
     }
 
     pinchOut(options)

Modified: trunk/Source/WebKit/ChangeLog (246212 => 246213)


--- trunk/Source/WebKit/ChangeLog	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/Source/WebKit/ChangeLog	2019-06-07 20:55:45 UTC (rev 246213)
@@ -1,3 +1,28 @@
+2019-06-07  Antoine Quint  <grao...@apple.com>
+
+        Restrict fast clicks everywhere to desktop content mode
+        https://bugs.webkit.org/show_bug.cgi?id=198610
+        <rdar://problem/50114230>
+
+        Reviewed by Dean Jackson.
+
+        We now set a new allowsFastClicksEverywhere property on the WebPageProxy when the content mode changes, set to true
+        when we're in desktop browsing mode. We now check on this property to opt into the fast clicks everywhere behavior.
+
+        This patch had been reverted once because it yielded some regressions in existing tests, notably under
+        fast/events/touch/ios/content-observation. This updated patch addresses this by ensuring the gesture recognizers
+        used for double-tap-to-zoom are disabled in -[WKContentViewInteraction _didStartProvisionalLoadForMainFrame]
+        to ensure that two tests dispatching a tap at the same location don't yield the recognition of a double-tap
+        rathern than the recognition of two single taps. 
+
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::allowsFastClicksEverywhere const):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
+        (_didStartProvisionalLoadForMainFrame):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
+
 2019-06-07  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Update sandboxes to address iokit-get-property errors

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (246212 => 246213)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-06-07 20:55:45 UTC (rev 246213)
@@ -518,6 +518,8 @@
 
     bool hasCommittedAnyProvisionalLoads() const { return m_hasCommittedAnyProvisionalLoads; }
 
+    bool allowsFastClicksEverywhere() const { return m_allowsFastClicksEverywhere; }
+
     void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
     bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
 
@@ -2481,6 +2483,7 @@
     bool m_isUsingHighPerformanceWebGL { false };
     bool m_openedByDOM { false };
     bool m_hasCommittedAnyProvisionalLoads { false };
+    bool m_allowsFastClicksEverywhere { false };
 
     HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
     HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (246212 => 246213)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-06-07 20:55:45 UTC (rev 246213)
@@ -1587,7 +1587,7 @@
     if (!_potentialTapInProgress)
         return;
 
-    if (_page->preferences().fastClicksEverywhere()) {
+    if (_page->preferences().fastClicksEverywhere() && _page->allowsFastClicksEverywhere()) {
         RELEASE_LOG(ViewGestures, "Potential tap found an element and fast taps are forced on. Trigger click. (%p)", self);
         [self _setDoubleTapGesturesEnabled:NO];
         return;
@@ -3791,6 +3791,10 @@
     // 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];
+    // We also need to disable the double-tap gesture recognizers that are enabled for double-tap-to-zoom and which
+    // are enabled when a single tap is first recognized. This avoids tests running in sequence and simulating taps
+    // in the same location to trigger double-tap recognition.
+    [self _setDoubleTapGesturesEnabled:NO];
 }
 
 #if !USE(UIKIT_KEYBOARD_ADDITIONS)

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (246212 => 246213)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-06-07 20:08:38 UTC (rev 246212)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-06-07 20:55:45 UTC (rev 246213)
@@ -1376,6 +1376,8 @@
         break;
     }
 
+    m_allowsFastClicksEverywhere = false;
+
     if (!useDesktopBrowsingMode)
         return WebContentMode::Mobile;
 
@@ -1397,6 +1399,7 @@
         policies.setMediaSourcePolicy(WebsiteMediaSourcePolicy::Enable);
         policies.setSimulatedMouseEventsDispatchPolicy(WebsiteSimulatedMouseEventsDispatchPolicy::Allow);
         policies.setLegacyOverflowScrollingTouchPolicy(WebsiteLegacyOverflowScrollingTouchPolicy::Disable);
+        m_allowsFastClicksEverywhere = true;
     }
 
     return WebContentMode::Desktop;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to