Title: [193474] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (193473 => 193474)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2015-12-04 22:38:01 UTC (rev 193473)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2015-12-04 22:38:05 UTC (rev 193474)
@@ -1,5 +1,23 @@
 2015-12-04  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r191072. rdar://problem/23732400
+
+    2015-10-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Web pages with unscalable viewports shouldn't have a single tap delay
+            https://bugs.webkit.org/show_bug.cgi?id=149968
+            <rdar://problem/23054453>
+
+            Reviewed by Simon Fraser.
+
+            Add a layout test to check that when a viewport is unscalable (specified through
+            the meta viewport tag) we do not add a delay to our single tap gesture recognizer.
+
+            * fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt: Added.
+            * fast/events/ios/unscalable-viewport-clicks-on-doubletap.html: Added.
+
+2015-12-04  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r190595. rdar://problem/23732402
 
     2015-10-05  Dean Jackson  <d...@apple.com>

Added: branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt (0 => 193474)


--- branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	2015-12-04 22:38:05 UTC (rev 193474)
@@ -0,0 +1,5 @@
+
+Double tapping on the button should fire 2 click events.
+Click!
+Click!
+

Added: branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html (0 => 193474)


--- branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	2015-12-04 22:38:05 UTC (rev 193474)
@@ -0,0 +1,55 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<meta id="viewport-data" name="viewport" content="user-scalable=no, initial-scale=1.0">
+
+<head>
+    <script id="ui-script" type="text/plain">
+        (function() {
+            uiController.doubleTapAtPoint(50, 50, function() {});
+        })();
+    </script>
+
+    <script>
+    var clickCount = 0;
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function getUIScript() {
+        return document.getElementById("ui-script").text;
+    }
+
+    function runTest() {
+        if (testRunner.runUIScript) {
+            testRunner.runUIScript(getUIScript(), function(result) {});
+        }
+    }
+    function handleClicked() {
+        clickCount++;
+        document.body.appendChild(document.createTextNode("Click!"));
+        document.body.appendChild(document.createElement("br"));
+        if (clickCount == 2)
+            testRunner.notifyDone();
+    }
+    </script>
+
+    <style>
+    body {
+        margin: 0;
+    }
+
+    #target {
+        width: 100px;
+        height: 100px;
+    }
+    </style>
+</head>
+
+<body _onload_="runTest()">
+    <button id="target" _onclick_="handleClicked()"></button>
+    <div>Double tapping on the button should fire 2 click events.</div>
+</body>
+
+</html>

Modified: branches/safari-601-branch/Source/WebKit2/ChangeLog (193473 => 193474)


--- branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-04 22:38:01 UTC (rev 193473)
+++ branches/safari-601-branch/Source/WebKit2/ChangeLog	2015-12-04 22:38:05 UTC (rev 193474)
@@ -1,3 +1,32 @@
+2015-12-04  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r191072. rdar://problem/23732400
+
+    2015-10-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Web pages with unscalable viewports shouldn't have a single tap delay
+            https://bugs.webkit.org/show_bug.cgi?id=149968
+            <rdar://problem/23054453>
+
+            Reviewed by Simon Fraser.
+
+            When a viewport is unscalable (specified through the meta viewport tag) we
+            do not add a delay to our single tap gesture recognizer. We do this by
+            disabling or reinitializing the WKContentView's double tap gesture recognizer
+            when the viewport becomes unscalable or scalable, respectively. A viewport is
+            deemed unscalable when it has user-scalable = no, or when the minimum scale is
+            greater than or equal to the maximum scale.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _didCommitLayerTree:]):
+            * UIProcess/ios/WKContentViewInteraction.h:
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Pulled logic
+                    for initializing a double tap gesture recognizer out into a helper function.
+            (-[WKContentView setupInteraction]):
+            (-[WKContentView _setDoubleTapGesturesEnabled:]): Turns gesture recognition for double
+                    taps on or off.
+
 2015-12-03  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r188647. rdar://problem/23732386

Modified: branches/safari-601-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (193473 => 193474)


--- branches/safari-601-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-12-04 22:38:01 UTC (rev 193473)
+++ branches/safari-601-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-12-04 22:38:05 UTC (rev 193474)
@@ -1005,6 +1005,8 @@
         }
     }
 
+    [_contentView _setDoubleTapGesturesEnabled:[_scrollView isZoomEnabled] && [_scrollView minimumZoomScale] < [_scrollView maximumZoomScale]];
+
     [self _updateScrollViewBackground];
 
     if (_gestureController)

Modified: branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (193473 => 193474)


--- branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2015-12-04 22:38:01 UTC (rev 193473)
+++ branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2015-12-04 22:38:05 UTC (rev 193474)
@@ -206,6 +206,7 @@
 - (void)_enableInspectorNodeSearch;
 - (void)_disableInspectorNodeSearch;
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler;
+- (void)_setDoubleTapGesturesEnabled:(BOOL)enabled;
 @end
 
 #if HAVE(LINK_PREVIEW)

Modified: branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (193473 => 193474)


--- branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-12-04 22:38:01 UTC (rev 193473)
+++ branches/safari-601-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-12-04 22:38:05 UTC (rev 193474)
@@ -296,6 +296,15 @@
     return UIWebSelectionModeWeb;
 }
 
+- (void)_createAndConfigureDoubleTapGestureRecognizer
+{
+    _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]);
+    [_doubleTapGestureRecognizer setNumberOfTapsRequired:2];
+    [_doubleTapGestureRecognizer setDelegate:self];
+    [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
+    [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()];
+}
+
 - (void)setupInteraction
 {
     if (!_interactionViewsContainerView) {
@@ -319,11 +328,7 @@
     [_singleTapGestureRecognizer setResetTarget:self action:@selector(_singleTapDidReset:)];
     [self addGestureRecognizer:_singleTapGestureRecognizer.get()];
 
-    _doubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognized:)]);
-    [_doubleTapGestureRecognizer setNumberOfTapsRequired:2];
-    [_doubleTapGestureRecognizer setDelegate:self];
-    [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
-    [_singleTapGestureRecognizer requireOtherGestureToFail:_doubleTapGestureRecognizer.get()];
+    [self _createAndConfigureDoubleTapGestureRecognizer];
 
     _twoFingerDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerDoubleTapRecognized:)]);
     [_twoFingerDoubleTapGestureRecognizer setNumberOfTapsRequired:2];
@@ -2226,6 +2231,18 @@
     });
 }
 
+- (void)_setDoubleTapGesturesEnabled:(BOOL)enabled
+{
+    if (enabled && ![_doubleTapGestureRecognizer isEnabled]) {
+        // The first tap recognized after re-enabling double tap gestures will not wait for the
+        // second tap before committing. To fix this, we use a new double tap gesture recognizer.
+        [self removeGestureRecognizer:_doubleTapGestureRecognizer.get()];
+        [_doubleTapGestureRecognizer setDelegate:nil];
+        [self _createAndConfigureDoubleTapGestureRecognizer];
+    }
+    [_doubleTapGestureRecognizer setEnabled:enabled];
+}
+
 - (void)accessoryAutoFill
 {
     id <_WKFormDelegate> formDelegate = [_webView _formDelegate];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to