Title: [202179] trunk
Revision
202179
Author
[email protected]
Date
2016-06-17 14:21:52 -0700 (Fri, 17 Jun 2016)

Log Message

REGRESSION: Double tap to zoom does not work on yahoo finance
https://bugs.webkit.org/show_bug.cgi?id=158886
<rdar://problem/24917760>

Reviewed by Simon Fraser.

Source/WebKit2:

We shouldn't enable fast click on pages that have
had to shrink to fit. In other words, we should enable
double-tap-to-zoom if the page has already zoomed.

Test: fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _allowsDoubleTapGestures]):

LayoutTests:

* fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt: Added.
* fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202178 => 202179)


--- trunk/LayoutTests/ChangeLog	2016-06-17 20:51:11 UTC (rev 202178)
+++ trunk/LayoutTests/ChangeLog	2016-06-17 21:21:52 UTC (rev 202179)
@@ -1,3 +1,14 @@
+2016-06-17  Dean Jackson  <[email protected]>
+
+        REGRESSION: Double tap to zoom does not work on yahoo finance
+        https://bugs.webkit.org/show_bug.cgi?id=158886
+        <rdar://problem/24917760>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt: Added.
+        * fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html: Added.
+
 2016-06-17  Chris Dumez  <[email protected]>
 
         TouchEvent should have a constructor

Added: trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt (0 => 202179)


--- trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt	2016-06-17 21:21:52 UTC (rev 202179)
@@ -0,0 +1,4 @@
+The viewport zoomed to scale: 1.6
+This test ensures that a page with width=device-width but content that causes a shrink-to-fit will not block double-tap-to-zoom. It runs automatically in WebKit tests. If you're viewing this manually, double tap on this text and the page should zoom in.
+
+This is an element that will cause shrinkage.
Property changes on: trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html (0 => 202179)


--- trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html	2016-06-17 21:21:52 UTC (rev 202179)
@@ -0,0 +1,61 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<meta name="viewport" content="width=device-width">
+<head>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getUIScript()
+        {
+            return `
+                (function() {
+                    uiController.didEndZoomingCallback = function() {
+                        uiController.uiScriptComplete(uiController.zoomScale);
+                    };
+                    uiController.doubleTapAtPoint(15, 15, function() {});
+                })();`;
+        }
+
+        function runTest()
+        {
+            if (!window.eventSender || !testRunner.runUIScript)
+                return;
+
+            testRunner.runUIScript(getUIScript(), function(result) {
+                document.getElementById("target").innerText = "The viewport zoomed to scale: " + result;
+                testRunner.notifyDone();
+            });
+        }
+    </script>
+    <style>
+        body {
+            margin: 0;
+            min-width: 800px;
+        }
+        p {
+            width: 300px;
+        }
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    </style>
+</head>
+<body _onload_="runTest()">
+<div id="target"></div>
+<p>
+    This test ensures that a page with width=device-width but content that
+    causes a shrink-to-fit will not block double-tap-to-zoom. It runs automatically
+    in WebKit tests. If you're viewing this manually, double tap on this text and
+    the page should zoom in.
+</p>
+<p style="height: 3000px; background-color: #f0e0f0">
+    This is an element that will cause shrinkage.
+</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebKit2/ChangeLog (202178 => 202179)


--- trunk/Source/WebKit2/ChangeLog	2016-06-17 20:51:11 UTC (rev 202178)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-17 21:21:52 UTC (rev 202179)
@@ -1,3 +1,20 @@
+2016-06-17  Dean Jackson  <[email protected]>
+
+        REGRESSION: Double tap to zoom does not work on yahoo finance
+        https://bugs.webkit.org/show_bug.cgi?id=158886
+        <rdar://problem/24917760>
+
+        Reviewed by Simon Fraser.
+
+        We shouldn't enable fast click on pages that have
+        had to shrink to fit. In other words, we should enable
+        double-tap-to-zoom if the page has already zoomed.
+
+        Test: fast/events/ios/viewport-shrink-to-fit-allows-double-tap.html
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _allowsDoubleTapGestures]):
+
 2016-06-16  Chris Dumez  <[email protected]>
 
         No need to ref connection in lambda inside NetworkResourceLoader::tryStoreAsCacheEntry()

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (202178 => 202179)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-06-17 20:51:11 UTC (rev 202178)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-06-17 21:21:52 UTC (rev 202179)
@@ -1735,11 +1735,16 @@
     if (!_viewportMetaTagWidthWasExplicit || _viewportMetaTagCameFromImageDocument)
         return YES;
 
-    // For scalable viewports, only disable double tap gestures if the viewport width is device width.
+    // If the page set a viewport width that wasn't the device width, then it was
+    // scaled and thus will probably need to zoom.
     if (_viewportMetaTagWidth != WebCore::ViewportArguments::ValueDeviceWidth)
         return YES;
 
-    return !areEssentiallyEqualAsFloat(contentZoomScale(self), _initialScaleFactor);
+    // At this point, we have a page that asked for width = device-width. However,
+    // if the content's width and height were large, we might have had to shrink it.
+    // Since we'll enable double tap zoom whenever we're not at the actual
+    // initial scale, this simply becomes a test of the current scale against 1.
+    return !areEssentiallyEqualAsFloat(contentZoomScale(self), 1);
 }
 
 #pragma mark - UIScrollViewDelegate
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to