Title: [262959] trunk
Revision
262959
Author
[email protected]
Date
2020-06-12 11:03:48 -0700 (Fri, 12 Jun 2020)

Log Message

Double tap to zoom out doesn't work after upgrading to iOS 13
https://bugs.webkit.org/show_bug.cgi?id=205158
<rdar://problem/205158>

Reviewed by Wenson Hsieh.

Source/WebKit:

Test: fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html

In order to determine whether a significant zoom to happen, we should use the current page scale
factor and not the initial page scale factor.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):

LayoutTests:

Add a test that double taps to zoom in and then double taps to zoom out. This test would fail to zoom
out prior to this source change. This test is skipped on iPad since desktop-class browsing mode has
heuristics that would prevent the second double-tap to zoom out.

* fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out-expected.txt: Added.
* fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html: Added.
* platform/ipad/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262958 => 262959)


--- trunk/LayoutTests/ChangeLog	2020-06-12 17:40:32 UTC (rev 262958)
+++ trunk/LayoutTests/ChangeLog	2020-06-12 18:03:48 UTC (rev 262959)
@@ -1,3 +1,19 @@
+2020-06-12  Antoine Quint  <[email protected]>
+
+        Double tap to zoom out doesn't work after upgrading to iOS 13
+        https://bugs.webkit.org/show_bug.cgi?id=205158
+        <rdar://problem/205158>
+
+        Reviewed by Wenson Hsieh.
+
+        Add a test that double taps to zoom in and then double taps to zoom out. This test would fail to zoom
+        out prior to this source change. This test is skipped on iPad since desktop-class browsing mode has
+        heuristics that would prevent the second double-tap to zoom out.
+
+        * fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out-expected.txt: Added.
+        * fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html: Added.
+        * platform/ipad/TestExpectations:
+
 2020-06-12  Jason Lawrence  <[email protected]>
 
         REGRESSION: (r262397): [ Mac wk2 ] inspector/canvas/create-context-webgpu.html is flaky failing.

Added: trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out-expected.txt (0 => 262959)


--- trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out-expected.txt	2020-06-12 18:03:48 UTC (rev 262959)
@@ -0,0 +1,3 @@
+
+PASS Testing that double-tapping once on text zooms in and then double-tapping again zooms back out. 
+

Added: trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html (0 => 262959)


--- trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html	2020-06-12 18:03:48 UTC (rev 262959)
@@ -0,0 +1,34 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<p style="width: 50px">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+document.addEventListener("click", event => {});
+
+promise_test(async () => {
+    const initialPageScaleFactor = window.internals.pageScaleFactor();
+
+    // Double tap to zoom in on the text.
+    await UIHelper.humanSpeedDoubleTapAt(30, 100);
+    assert_not_equals(window.internals.pageScaleFactor(), initialPageScaleFactor, "The page zoomed in after double-tapping.");
+
+    // Double tap a second time to zoom out.
+    await UIHelper.humanSpeedDoubleTapAt(30, 100);
+    assert_equals(window.internals.pageScaleFactor(), initialPageScaleFactor, "The page was zoomed back out after double-tapping.");
+
+    document.querySelector("p").remove();
+}, "Testing that double-tapping once on text zooms in and then double-tapping again zooms back out.");
+
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ipad/TestExpectations (262958 => 262959)


--- trunk/LayoutTests/platform/ipad/TestExpectations	2020-06-12 17:40:32 UTC (rev 262958)
+++ trunk/LayoutTests/platform/ipad/TestExpectations	2020-06-12 18:03:48 UTC (rev 262959)
@@ -66,3 +66,7 @@
 webkit.org/b/203264 editing/pasteboard/smart-paste-paragraph-004.html [ Pass ]
 
 media/picture-in-picture [ Pass ]
+
+# This test cannot work on iPad because in desktop mode the double-tap-to-zoom-out would be prevented
+# due to heuristics specific to the desktop-class browsing mode. 
+fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html [ Skip ]

Modified: trunk/Source/WebKit/ChangeLog (262958 => 262959)


--- trunk/Source/WebKit/ChangeLog	2020-06-12 17:40:32 UTC (rev 262958)
+++ trunk/Source/WebKit/ChangeLog	2020-06-12 18:03:48 UTC (rev 262959)
@@ -1,3 +1,19 @@
+2020-06-12  Antoine Quint  <[email protected]>
+
+        Double tap to zoom out doesn't work after upgrading to iOS 13
+        https://bugs.webkit.org/show_bug.cgi?id=205158
+        <rdar://problem/205158>
+
+        Reviewed by Wenson Hsieh.
+
+        Test: fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html
+
+        In order to determine whether a significant zoom to happen, we should use the current page scale
+        factor and not the initial page scale factor.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
+
 2020-06-12  Alex Christensen  <[email protected]>
 
         Add WKUserScript initializer SPI with alternative names

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (262958 => 262959)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-06-12 17:40:32 UTC (rev 262958)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-06-12 18:03:48 UTC (rev 262959)
@@ -1861,10 +1861,9 @@
         return;
     }
 
+    auto currentScale = self._contentZoomScale;
     auto targetScale = _smartMagnificationController->zoomFactorForTargetRect(renderRect, fitEntireRect, viewportMinimumScale, viewportMaximumScale);
-
-    auto initialScale = [self _initialScaleFactor];
-    if (std::min(targetScale, initialScale) / std::max(targetScale, initialScale) > fasterTapSignificantZoomThreshold) {
+    if (std::min(targetScale, currentScale) / std::max(targetScale, currentScale) > fasterTapSignificantZoomThreshold) {
         RELEASE_LOG(ViewGestures, "Potential tap would not cause a significant zoom. Trigger click. (%p)", self);
         [self _setDoubleTapGesturesEnabled:NO];
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to