Title: [193553] branches/safari-601.1.46-branch

Diff

Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193552 => 193553)


--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-12-06 05:56:25 UTC (rev 193552)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-12-06 06:09:46 UTC (rev 193553)
@@ -1,3 +1,21 @@
+2015-12-05  Babak Shafiei  <[email protected]>
+
+        Merge r191072.
+
+    2015-10-14  Wenson Hsieh  <[email protected]>
+
+            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-05  David Kilzer  <[email protected]>
 
         Merge r191981. rdar://problem/23221177

Copied: branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt (from rev 193474, branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt) (0 => 193553)


--- branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap-expected.txt	2015-12-06 06:09:46 UTC (rev 193553)
@@ -0,0 +1,5 @@
+
+Double tapping on the button should fire 2 click events.
+Click!
+Click!
+

Copied: branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html (from rev 193474, branches/safari-601-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html) (0 => 193553)


--- branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/events/ios/unscalable-viewport-clicks-on-doubletap.html	2015-12-06 06:09:46 UTC (rev 193553)
@@ -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.1.46-branch/Source/WebKit2/ChangeLog (193552 => 193553)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-12-06 05:56:25 UTC (rev 193552)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2015-12-06 06:09:46 UTC (rev 193553)
@@ -1,3 +1,32 @@
+2015-12-05  Babak Shafiei  <[email protected]>
+
+        Merge r191072.
+
+    2015-10-14  Wenson Hsieh  <[email protected]>
+
+            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-02  Matthew Hanson  <[email protected]>
 
         Merge r192811. rdar://problem/23730032

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (193552 => 193553)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-12-06 05:56:25 UTC (rev 193552)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-12-06 06:09:46 UTC (rev 193553)
@@ -994,6 +994,8 @@
     if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom])
         [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
 
+    [_contentView _setDoubleTapGesturesEnabled:[_scrollView isZoomEnabled] && [_scrollView minimumZoomScale] < [_scrollView maximumZoomScale]];
+
     [self _updateScrollViewBackground];
 
     if (_gestureController)

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (193552 => 193553)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2015-12-06 05:56:25 UTC (rev 193552)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2015-12-06 06:09:46 UTC (rev 193553)
@@ -208,6 +208,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.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (193552 => 193553)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-12-06 05:56:25 UTC (rev 193552)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-12-06 06:09:46 UTC (rev 193553)
@@ -320,6 +320,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) {
@@ -343,11 +352,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];
@@ -2266,6 +2271,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to