Single tapping clickable elements in unscalable pages should show a tap highlight
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 22:30:59 +0000 (22:30 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Oct 2015 22:30:59 +0000 (22:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150382

Reviewed by Simon Fraser.

When the double tap gesture recognizer is disabled ahead of time (as in the case of unscalable pages) the tap is
committed before the geometries come in. To fix this, we introduce a flag that allows the single tap to be
committed before the tap highlight arrives. This allows the tap highlight to be immediately animated when receiving
the tap highlight geometries only in the case where double tapping is disabled when recognizing the single tap.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
(-[WKContentView _singleTapRecognized:]):
(-[WKContentView _singleTapCommited:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index e2919c47a70e09e80d29719bb90eef93a958282f..906a19f4649e3f8b093e4a3a90356a05aed5642b 100644 (file)
@@ -1,3 +1,23 @@
+2015-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Single tapping clickable elements in unscalable pages should show a tap highlight
+        https://bugs.webkit.org/show_bug.cgi?id=150382
+
+        Reviewed by Simon Fraser.
+
+        When the double tap gesture recognizer is disabled ahead of time (as in the case of unscalable pages) the tap is
+        committed before the geometries come in. To fix this, we introduce a flag that allows the single tap to be
+        committed before the tap highlight arrives. This allows the tap highlight to be immediately animated when receiving
+        the tap highlight geometries only in the case where double tapping is disabled when recognizing the single tap.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
+        (-[WKContentView _singleTapRecognized:]):
+        (-[WKContentView _singleTapCommited:]):
+
 2015-10-21  Anders Carlsson  <andersca@apple.com>
 
         Get rid of useBinaryEncoding from WKPageGetContentsAsMHTMLData
index f07d84332aa3fdf0c022fec41db7fb1c970a260a..cea2826726415e639ae64c5c65d28dc3c727bdc1 100644 (file)
@@ -158,6 +158,7 @@ struct WKAutoCorrectionData {
     BOOL _usingGestureForSelection;
     BOOL _inspectorNodeSearchEnabled;
     BOOL _didAccessoryTabInitiateFocus;
+    BOOL _isExpectingFastSingleTapCommit;
 }
 
 @end
index a03488990b8340b9e76ec9889a2df42ba91e7724..13005888e3e515b309e7569efbe106580f3348ac 100644 (file)
@@ -453,6 +453,7 @@ static UIWebSelectionMode toUIWebSelectionMode(WKSelectionGranularity granularit
     _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]);
     [_actionSheetAssistant setDelegate:self];
     _smartMagnificationController = std::make_unique<SmartMagnificationController>(self);
+    _isExpectingFastSingleTapCommit = NO;
 }
 
 - (void)cleanupInteraction
@@ -462,6 +463,7 @@ static UIWebSelectionMode toUIWebSelectionMode(WKSelectionGranularity granularit
     _actionSheetAssistant = nil;
     _smartMagnificationController = nil;
     _didAccessoryTabInitiateFocus = NO;
+    _isExpectingFastSingleTapCommit = NO;
     [_formInputSession invalidate];
     _formInputSession = nil;
     [_highlightView removeFromSuperview];
@@ -849,6 +851,11 @@ static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius,
     }
 
     [self _showTapHighlight];
+    if (_isExpectingFastSingleTapCommit) {
+        [self _finishInteraction];
+        if (!_potentialTapInProgress)
+            _isExpectingFastSingleTapCommit = NO;
+    }
 }
 
 - (CGFloat)_fastClickZoomThreshold
@@ -1244,6 +1251,7 @@ static inline bool isSamePair(UIGestureRecognizer *a, UIGestureRecognizer *b, UI
     _page->potentialTapAtPosition(gestureRecognizer.location, ++_latestTapID);
     _potentialTapInProgress = YES;
     _isTapHighlightIDValid = YES;
+    _isExpectingFastSingleTapCommit = !_doubleTapGestureRecognizer.get().enabled;
 }
 
 static void cancelPotentialTapIfNecessary(WKContentView* contentView)
@@ -1297,7 +1305,8 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
 
     _page->commitPotentialTap();
 
-    [self _finishInteraction];
+    if (!_isExpectingFastSingleTapCommit)
+        [self _finishInteraction];
 }
 
 - (void)_doubleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer