Title: [247866] trunk
Revision
247866
Author
[email protected]
Date
2019-07-26 11:22:06 -0700 (Fri, 26 Jul 2019)

Log Message

Unable to tap/double tap to open files/folders in Google Drive in Safari
https://bugs.webkit.org/show_bug.cgi?id=200096
<rdar://problem/52748552>

Reviewed by Wenson Hsieh.

Source/WebKit:

This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
(WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _removeDefaultGestureRecognizers]):
(-[WKContentView _addDefaultGestureRecognizers]):
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
(-[WKContentView gestureRecognizerShouldBegin:]):
(-[WKContentView _doubleTapRecognizedForDoubleClick:]):
(-[WKContentView _didStartProvisionalLoadForMainFrame]):
(-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
(-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
(-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.

LayoutTests:

1. Rebaseline (progression).
2. Payment request tests activate elements by tapping on them at a high speed, triggering double clicks instead. Let's slow them down a bit.

* fast/events/touch/ios/double-tap-for-double-click3-expected.txt:
* http/tests/adClickAttribution/anchor-tag-attributes-validation.html:
* http/tests/resources/payment-request.js:
(activateThen):
* resources/ui-helper.js:
(window.UIHelper.activateElementAtHumanSpeed.return.new.Promise):
(window.UIHelper.activateElementAtHumanSpeed):
* tests-options.json:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247865 => 247866)


--- trunk/LayoutTests/ChangeLog	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/ChangeLog	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1,3 +1,23 @@
+2019-07-26  Zalan Bujtas  <[email protected]>
+
+        Unable to tap/double tap to open files/folders in Google Drive in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=200096
+        <rdar://problem/52748552>
+
+        Reviewed by Wenson Hsieh.
+
+        1. Rebaseline (progression).
+        2. Payment request tests activate elements by tapping on them at a high speed, triggering double clicks instead. Let's slow them down a bit.
+
+        * fast/events/touch/ios/double-tap-for-double-click3-expected.txt:
+        * http/tests/adClickAttribution/anchor-tag-attributes-validation.html:
+        * http/tests/resources/payment-request.js:
+        (activateThen):
+        * resources/ui-helper.js:
+        (window.UIHelper.activateElementAtHumanSpeed.return.new.Promise):
+        (window.UIHelper.activateElementAtHumanSpeed):
+        * tests-options.json:
+
 2019-07-26  Rob Buis  <[email protected]>
 
         Make storing cross-origin top-level prefetches in HTTP cache optional

Modified: trunk/LayoutTests/fast/events/touch/ios/double-tap-for-double-click3-expected.txt (247865 => 247866)


--- trunk/LayoutTests/fast/events/touch/ios/double-tap-for-double-click3-expected.txt	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/fast/events/touch/ios/double-tap-for-double-click3-expected.txt	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1,2 +1,2 @@
 PASS if 'double click' text is NOT shown below.
-[click][click]
+[click]

Modified: trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt (247865 => 247866)


--- trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation-expected.txt	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1,14 +1,14 @@
-CONSOLE MESSAGE: line 165: adcampaignid must have a non-negative value less than or equal to 63 for Ad Click Attribution.
-CONSOLE MESSAGE: line 165: adcampaignid must have a non-negative value less than or equal to 63 for Ad Click Attribution.
-CONSOLE MESSAGE: line 165: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
-CONSOLE MESSAGE: line 165: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
-CONSOLE MESSAGE: line 165: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
-CONSOLE MESSAGE: line 165: addestination could not be converted to a valid HTTP-family URL.
-CONSOLE MESSAGE: line 165: addestination could not be converted to a valid HTTP-family URL.
-CONSOLE MESSAGE: line 165: addestination could not be converted to a valid HTTP-family URL.
-CONSOLE MESSAGE: line 165: Both adcampaignid and addestination need to be set for Ad Click Attribution to work.
-CONSOLE MESSAGE: line 165: Both adcampaignid and addestination need to be set for Ad Click Attribution to work.
-CONSOLE MESSAGE: line 165: addestination can not be the same site as the current website.
+CONSOLE MESSAGE: line 192: adcampaignid must have a non-negative value less than or equal to 63 for Ad Click Attribution.
+CONSOLE MESSAGE: line 192: adcampaignid must have a non-negative value less than or equal to 63 for Ad Click Attribution.
+CONSOLE MESSAGE: line 192: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
+CONSOLE MESSAGE: line 192: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
+CONSOLE MESSAGE: line 192: adcampaignid can not be converted to a non-negative integer which is required for Ad Click Attribution.
+CONSOLE MESSAGE: line 192: addestination could not be converted to a valid HTTP-family URL.
+CONSOLE MESSAGE: line 192: addestination could not be converted to a valid HTTP-family URL.
+CONSOLE MESSAGE: line 192: addestination could not be converted to a valid HTTP-family URL.
+CONSOLE MESSAGE: line 192: Both adcampaignid and addestination need to be set for Ad Click Attribution to work.
+CONSOLE MESSAGE: line 192: Both adcampaignid and addestination need to be set for Ad Click Attribution to work.
+CONSOLE MESSAGE: line 192: addestination can not be the same site as the current website.
 Test for validity of ad click attribution attributes on anchor tags.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation.html (247865 => 247866)


--- trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation.html	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/http/tests/adClickAttribution/anchor-tag-attributes-validation.html	2019-07-26 18:22:06 UTC (rev 247866)
@@ -25,10 +25,7 @@
     }
 
     function activateElement(elementID, callback) {
-        var element = document.getElementById(elementID);
-        var centerX = element.offsetLeft + element.offsetWidth / 2;
-        var centerY = element.offsetTop + element.offsetHeight / 2;
-        UIHelper.activateAt(centerX, centerY).then(
+        UIHelper.activateElementAtHumanSpeed(document.getElementById(elementID)).then(
             function () {
                 callback();
             },

Modified: trunk/LayoutTests/http/tests/resources/payment-request.js (247865 => 247866)


--- trunk/LayoutTests/http/tests/resources/payment-request.js	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/http/tests/resources/payment-request.js	2019-07-26 18:22:06 UTC (rev 247866)
@@ -8,7 +8,7 @@
             resolve(completion());
         };
         document.body.insertBefore(button, document.body.firstChild);
-        UIHelper.activateElement(button);
+        UIHelper.activateElementAtHumanSpeed(button);
     });
 }
 

Modified: trunk/LayoutTests/resources/ui-helper.js (247865 => 247866)


--- trunk/LayoutTests/resources/ui-helper.js	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/resources/ui-helper.js	2019-07-26 18:22:06 UTC (rev 247866)
@@ -181,6 +181,27 @@
         return UIHelper.activateAt(x, y);
     }
 
+    static activateElementAtHumanSpeed(element)
+    {
+        const x = element.offsetLeft + element.offsetWidth / 2;
+        const y = element.offsetTop + element.offsetHeight / 2;
+
+        if (!this.isWebKit2() || !this.isIOSFamily()) {
+            eventSender.mouseMoveTo(x, y);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            return Promise.resolve();
+        }
+
+        return new Promise(async (resolve) => {
+            await new Promise(resolveAfterDelay => setTimeout(resolveAfterDelay, 350));
+            testRunner.runUIScript(`
+                uiController.singleTapAtPoint(${x}, ${y}, function() {
+                    uiController.uiScriptComplete();
+                });`, resolve);
+        });
+    }
+
     static async doubleActivateAt(x, y)
     {
         if (this.isIOSFamily())

Modified: trunk/LayoutTests/tests-options.json (247865 => 247866)


--- trunk/LayoutTests/tests-options.json	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/LayoutTests/tests-options.json	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1897,5 +1897,8 @@
     ],
     "imported/w3c/web-platform-tests/xhr/xmlhttprequest-timeout-worker-twice.html": [
         "slow"
+    ],
+    "http/tests/paymentrequest/payment-response-reference-cycle-leak.https.html": [
+        "slow"
     ]
 }
\ No newline at end of file

Modified: trunk/Source/WebKit/ChangeLog (247865 => 247866)


--- trunk/Source/WebKit/ChangeLog	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/ChangeLog	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1,3 +1,48 @@
+2019-07-26  Zalan Bujtas  <[email protected]>
+
+        Unable to tap/double tap to open files/folders in Google Drive in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=200096
+        <rdar://problem/52748552>
+
+        Reviewed by Wenson Hsieh.
+
+        This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
+        (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView _removeDefaultGestureRecognizers]):
+        (-[WKContentView _addDefaultGestureRecognizers]):
+        (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
+        (-[WKContentView gestureRecognizerShouldBegin:]):
+        (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
+        (-[WKContentView _didStartProvisionalLoadForMainFrame]):
+        (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
+        (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
+        (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
+        (WebKit::WebPage::commitPotentialTap):
+        (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
+
 2019-07-26  Eric Liang  <[email protected]>
 
         AX: web process should load correct bundle path for MACCATALYST

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (247865 => 247866)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2019-07-26 18:22:06 UTC (rev 247866)
@@ -98,8 +98,6 @@
     encoder << deviceOrientation;
     encoder << keyboardIsAttached;
     encoder << canShowWhileLocked;
-    encoder << doubleTapForDoubleClickDelay;
-    encoder << doubleTapForDoubleClickRadius;
     encoder << overrideViewportArguments;
 #endif
 #if PLATFORM(COCOA)
@@ -292,10 +290,6 @@
         return WTF::nullopt;
     if (!decoder.decode(parameters.canShowWhileLocked))
         return WTF::nullopt;
-    if (!decoder.decode(parameters.doubleTapForDoubleClickDelay))
-        return WTF::nullopt;
-    if (!decoder.decode(parameters.doubleTapForDoubleClickRadius))
-        return WTF::nullopt;
 
     Optional<Optional<WebCore::ViewportArguments>> overrideViewportArguments;
     decoder >> overrideViewportArguments;

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (247865 => 247866)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -158,8 +158,6 @@
     int32_t deviceOrientation { 0 };
     bool keyboardIsAttached { false };
     bool canShowWhileLocked { false };
-    Seconds doubleTapForDoubleClickDelay { 350_ms };
-    float doubleTapForDoubleClickRadius { 45 };
     Optional<WebCore::ViewportArguments> overrideViewportArguments;
 #endif
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -413,9 +413,6 @@
     virtual void disableInspectorNodeSearch() = 0;
 
     virtual void handleAutocorrectionContext(const WebAutocorrectionContext&) = 0;
-
-    virtual Seconds doubleTapForDoubleClickDelay() = 0;
-    virtual float doubleTapForDoubleClickRadius() = 0;
 #endif
 
     // Auxiliary Client Creation

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-07-26 18:22:06 UTC (rev 247866)
@@ -7211,8 +7211,6 @@
     parameters.keyboardIsAttached = isInHardwareKeyboardMode();
     parameters.overrideViewportArguments = m_overrideViewportArguments;
     parameters.canShowWhileLocked = m_configuration->canShowWhileLocked();
-    parameters.doubleTapForDoubleClickDelay = pageClient().doubleTapForDoubleClickDelay();
-    parameters.doubleTapForDoubleClickRadius = pageClient().doubleTapForDoubleClickRadius();
 #endif
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -1225,6 +1225,7 @@
     void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
     void handleTap(const WebCore::FloatPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t layerTreeTransactionIdAtLastTouchStart);
     void didRecognizeLongPress();
+    void handleDoubleTapForDoubleClickAtPoint(const WebCore::IntPoint&, OptionSet<WebEvent::Modifier>, uint64_t layerTreeTransactionIdAtLastTouchStart);
 
     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -243,9 +243,6 @@
 
     void handleAutocorrectionContext(const WebAutocorrectionContext&) final;
 
-    Seconds doubleTapForDoubleClickDelay() final;
-    float doubleTapForDoubleClickRadius() final;
-
     void didFinishProcessingAllPendingMouseEvents() final { }
 
 #if HAVE(PENCILKIT)

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2019-07-26 18:22:06 UTC (rev 247866)
@@ -842,16 +842,6 @@
 }
 #endif
 
-Seconds PageClientImpl::doubleTapForDoubleClickDelay()
-{
-    return Seconds { [m_contentView _doubleTapForDoubleClickDelay] };
-}
-
-float PageClientImpl::doubleTapForDoubleClickRadius()
-{
-    return [m_contentView _doubleTapForDoubleClickRadius];
-}
-
 #if USE(QUICK_LOOK)
 void PageClientImpl::requestPasswordForQuickLookDocument(const String& fileName, WTF::Function<void(const String&)>&& completionHandler)
 {

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -216,6 +216,7 @@
     RetainPtr<UILongPressGestureRecognizer> _longPressGestureRecognizer;
     RetainPtr<WKSyntheticTapGestureRecognizer> _doubleTapGestureRecognizer;
     RetainPtr<UITapGestureRecognizer> _nonBlockingDoubleTapGestureRecognizer;
+    RetainPtr<UITapGestureRecognizer> _doubleTapGestureRecognizerForDoubleClick;
     RetainPtr<UITapGestureRecognizer> _twoFingerDoubleTapGestureRecognizer;
     RetainPtr<UITapGestureRecognizer> _twoFingerSingleTapGestureRecognizer;
     RetainPtr<UITapGestureRecognizer> _stylusSingleTapGestureRecognizer;
@@ -480,8 +481,6 @@
 - (void)_disableInspectorNodeSearch;
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler;
 - (void)_setDoubleTapGesturesEnabled:(BOOL)enabled;
-- (double)_doubleTapForDoubleClickDelay;
-- (float)_doubleTapForDoubleClickRadius;
 #if ENABLE(DATA_DETECTION)
 - (NSArray *)_dataDetectionResults;
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-26 18:22:06 UTC (rev 247866)
@@ -688,16 +688,6 @@
     [self addGestureRecognizer:_longPressGestureRecognizer.get()];
 }
 
-- (void)_ensureNonBlockingDoubleTapGestureRecognizer
-{
-    if (_nonBlockingDoubleTapGestureRecognizer)
-        return;
-    _nonBlockingDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_nonBlockingDoubleTapRecognized:)]);
-    [_nonBlockingDoubleTapGestureRecognizer setNumberOfTapsRequired:2];
-    [_nonBlockingDoubleTapGestureRecognizer setDelegate:self];
-    [_nonBlockingDoubleTapGestureRecognizer setEnabled:NO];
-}
-
 - (void)setupInteraction
 {
     // If the page is not valid yet then delay interaction setup until the process is launched/relaunched.
@@ -744,9 +734,17 @@
 #endif
     [self addGestureRecognizer:_singleTapGestureRecognizer.get()];
 
-    [self _ensureNonBlockingDoubleTapGestureRecognizer];
+    _nonBlockingDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_nonBlockingDoubleTapRecognized:)]);
+    [_nonBlockingDoubleTapGestureRecognizer setNumberOfTapsRequired:2];
+    [_nonBlockingDoubleTapGestureRecognizer setDelegate:self];
+    [_nonBlockingDoubleTapGestureRecognizer setEnabled:NO];
     [self addGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
 
+    _doubleTapGestureRecognizerForDoubleClick = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_doubleTapRecognizedForDoubleClick:)]);
+    [_doubleTapGestureRecognizerForDoubleClick setNumberOfTapsRequired:2];
+    [_doubleTapGestureRecognizerForDoubleClick setDelegate:self];
+    [self addGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
+
     [self _createAndConfigureDoubleTapGestureRecognizer];
 
     _twoFingerDoubleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerDoubleTapRecognized:)]);
@@ -894,6 +892,9 @@
     [_nonBlockingDoubleTapGestureRecognizer setDelegate:nil];
     [self removeGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
 
+    [_doubleTapGestureRecognizerForDoubleClick setDelegate:nil];
+    [self removeGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
+
     [_twoFingerDoubleTapGestureRecognizer setDelegate:nil];
     [self removeGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
 
@@ -970,6 +971,7 @@
     [self removeGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
     [self removeGestureRecognizer:_doubleTapGestureRecognizer.get()];
     [self removeGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
+    [self removeGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
     [self removeGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
     [self removeGestureRecognizer:_twoFingerSingleTapGestureRecognizer.get()];
     [self removeGestureRecognizer:_stylusSingleTapGestureRecognizer.get()];
@@ -989,6 +991,7 @@
     [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
     [self addGestureRecognizer:_doubleTapGestureRecognizer.get()];
     [self addGestureRecognizer:_nonBlockingDoubleTapGestureRecognizer.get()];
+    [self addGestureRecognizer:_doubleTapGestureRecognizerForDoubleClick.get()];
     [self addGestureRecognizer:_twoFingerDoubleTapGestureRecognizer.get()];
     [self addGestureRecognizer:_twoFingerSingleTapGestureRecognizer.get()];
     [self addGestureRecognizer:_stylusSingleTapGestureRecognizer.get()];
@@ -1892,6 +1895,12 @@
     if (isSamePair(gestureRecognizer, otherGestureRecognizer, _highlightLongPressGestureRecognizer.get(), _previewGestureRecognizer.get()))
         return YES;
 
+    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _nonBlockingDoubleTapGestureRecognizer.get(), _doubleTapGestureRecognizerForDoubleClick.get()))
+        return YES;
+
+    if (isSamePair(gestureRecognizer, otherGestureRecognizer, _doubleTapGestureRecognizer.get(), _doubleTapGestureRecognizerForDoubleClick.get()))
+        return YES;
+
     return NO;
 }
 
@@ -2084,6 +2093,7 @@
     if (gestureRecognizer == _highlightLongPressGestureRecognizer
         || gestureRecognizer == _doubleTapGestureRecognizer
         || gestureRecognizer == _nonBlockingDoubleTapGestureRecognizer
+        || gestureRecognizer == _doubleTapGestureRecognizerForDoubleClick
         || gestureRecognizer == _twoFingerDoubleTapGestureRecognizer) {
 
         if (hasFocusedElement(_focusedElementInformation)) {
@@ -2322,6 +2332,11 @@
     }
 }
 
+- (void)_doubleTapRecognizedForDoubleClick:(UITapGestureRecognizer *)gestureRecognizer
+{
+    _page->handleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint(gestureRecognizer.location), WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), _layerTreeTransactionIdAtLastTouchStart);
+}
+
 - (void)_twoFingerSingleTapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer
 {
     _isTapHighlightIDValid = YES;
@@ -3898,7 +3913,10 @@
 
 - (void)_didStartProvisionalLoadForMainFrame
 {
-    // We need to disable the double-tap gesture recognizers that are enabled for double-tap-to-zoom and which
+    // Reset the double tap gesture recognizer to prevent any double click that is in the process of being recognized.
+    [_doubleTapGestureRecognizerForDoubleClick setEnabled:NO];
+    [_doubleTapGestureRecognizerForDoubleClick setEnabled:YES];
+    // We also need to disable the double-tap gesture recognizers that are enabled for double-tap-to-zoom and which
     // are enabled when a single tap is first recognized. This avoids tests running in sequence and simulating taps
     // in the same location to trigger double-tap recognition.
     [self _setDoubleTapGesturesEnabled:NO];
@@ -3968,28 +3986,6 @@
     [self _resetIsDoubleTapPending];
 }
 
-- (double)_doubleTapForDoubleClickDelay
-{
-    static double doubleTapForDoubleClickDelay = 350;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        [self _ensureNonBlockingDoubleTapGestureRecognizer];
-        doubleTapForDoubleClickDelay = [_nonBlockingDoubleTapGestureRecognizer maximumIntervalBetweenSuccessiveTaps];
-    });
-    return doubleTapForDoubleClickDelay;
-}
-
-- (float)_doubleTapForDoubleClickRadius
-{
-    static float doubleTapForDoubleClickRadius = 45;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        [self _ensureNonBlockingDoubleTapGestureRecognizer];
-        doubleTapForDoubleClickRadius = [_nonBlockingDoubleTapGestureRecognizer allowableMovement];
-    });
-    return doubleTapForDoubleClickRadius;
-}
-
 // MARK: UIWebFormAccessoryDelegate protocol and accessory methods
 
 - (void)accessoryClear

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (247865 => 247866)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-07-26 18:22:06 UTC (rev 247866)
@@ -838,6 +838,11 @@
     process().send(Messages::WebPage::DidRecognizeLongPress(), m_pageID);
 }
 
+void WebPageProxy::handleDoubleTapForDoubleClickAtPoint(const WebCore::IntPoint& point, OptionSet<WebEvent::Modifier> modifiers, uint64_t layerTreeTransactionIdAtLastTouchStart)
+{
+    process().send(Messages::WebPage::HandleDoubleTapForDoubleClickAtPoint(point, modifiers, layerTreeTransactionIdAtLastTouchStart), m_pageID);
+}
+
 void WebPageProxy::inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint& position)
 {
     process().send(Messages::WebPage::InspectorNodeSearchMovedToPosition(position), m_pageID);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (247865 => 247866)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-07-26 18:22:06 UTC (rev 247866)
@@ -416,8 +416,6 @@
     , m_deviceOrientation(parameters.deviceOrientation)
     , m_keyboardIsAttached(parameters.keyboardIsAttached)
     , m_canShowWhileLocked(parameters.canShowWhileLocked)
-    , m_doubleTapForDoubleClickDelay(parameters.doubleTapForDoubleClickDelay)
-    , m_doubleTapForDoubleClickRadius(parameters.doubleTapForDoubleClickRadius)
 #endif
     , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
     , m_activityState(parameters.activityState)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (247865 => 247866)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-07-26 18:22:06 UTC (rev 247866)
@@ -636,7 +636,7 @@
     void cancelPotentialTapInFrame(WebFrame&);
     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
     void didRecognizeLongPress();
-    bool handlePotentialDoubleTapForDoubleClickAtPoint(OptionSet<WebKit::WebEvent::Modifier>, uint64_t lastLayerTreeTransactionId);
+    void handleDoubleTapForDoubleClickAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t lastLayerTreeTransactionId);
 
     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
@@ -1868,8 +1868,6 @@
     bool m_keyboardIsAttached { false };
     bool m_canShowWhileLocked { false };
     bool m_inDynamicSizeUpdate { false };
-    Seconds m_doubleTapForDoubleClickDelay { 350_ms };
-    float m_doubleTapForDoubleClickRadius { 45 };
     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
     WebCore::FloatPoint m_pendingSyntheticClickLocation;
@@ -1880,8 +1878,6 @@
     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
     double m_lastTransactionPageScaleFactor { 0 };
     uint64_t m_lastTransactionIDWithScaleChange { 0 };
-    Optional<MonotonicTime> m_lastCommittedTapTimestamp;
-    Optional<WebCore::FloatPoint> m_lastCommittedTapLocation;
 
     CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply;
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (247865 => 247866)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-07-26 18:22:06 UTC (rev 247866)
@@ -59,6 +59,7 @@
     CancelPotentialTap()
     TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
     DidRecognizeLongPress()
+    HandleDoubleTapForDoubleClickAtPoint(WebCore::IntPoint point, OptionSet<WebKit::WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId)
     InspectorNodeSearchMovedToPosition(WebCore::FloatPoint point)
     InspectorNodeSearchEndedAtPosition(WebCore::FloatPoint point)
     BlurFocusedElement()

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (247865 => 247866)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-07-26 17:58:21 UTC (rev 247865)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-07-26 18:22:06 UTC (rev 247866)
@@ -832,27 +832,16 @@
         handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers);
 }
 
-bool WebPage::handlePotentialDoubleTapForDoubleClickAtPoint(OptionSet<WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId)
+void WebPage::handleDoubleTapForDoubleClickAtPoint(const IntPoint& point, OptionSet<WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId)
 {
-    if (!m_lastCommittedTapTimestamp || !m_lastCommittedTapLocation)
-        return false;
-
-    auto millisecondsSinceLastTap = (MonotonicTime::now() - *m_lastCommittedTapTimestamp).milliseconds();
-    if (millisecondsSinceLastTap > m_doubleTapForDoubleClickDelay.milliseconds())
-        return false;
-
-    auto distanceBetweenTaps = sqrtf(pow(m_potentialTapLocation.x() - m_lastCommittedTapLocation->x(), 2) + pow(m_potentialTapLocation.y() - m_lastCommittedTapLocation->y(), 2));
-    if (distanceBetweenTaps > m_doubleTapForDoubleClickRadius)
-        return false;
-
     FloatPoint adjustedPoint;
-    auto* nodeRespondingToDoubleClick = m_page->mainFrame().nodeRespondingToDoubleClickEvent(m_potentialTapLocation, adjustedPoint);
+    auto* nodeRespondingToDoubleClick = m_page->mainFrame().nodeRespondingToDoubleClickEvent(point, adjustedPoint);
     if (!nodeRespondingToDoubleClick)
-        return false;
+        return;
 
     auto* frameRespondingToDoubleClick = nodeRespondingToDoubleClick->document().frame();
     if (!frameRespondingToDoubleClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToDoubleClick)->firstLayerTreeTransactionIDAfterDidCommitLoad())
-        return false;
+        return;
 
     bool shiftKey = modifiers.contains(WebEvent::Modifier::ShiftKey);
     bool ctrlKey = modifiers.contains(WebEvent::Modifier::ControlKey);
@@ -861,9 +850,8 @@
     auto roundedAdjustedPoint = roundedIntPoint(adjustedPoint);
     nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
     if (m_isClosed)
-        return false;
+        return;
     nodeRespondingToDoubleClick->document().frame()->eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 2, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
-    return true;
 }
 
 void WebPage::requestFocusedElementInformation(WebKit::CallbackID callbackID)
@@ -1084,12 +1072,6 @@
 
 void WebPage::commitPotentialTap(OptionSet<WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId, WebCore::PointerID pointerId)
 {
-    auto currentPotentialTapLocation = m_potentialTapLocation; 
-    auto updateLastCommittedLocationAndTimestamp = [&] {
-        m_lastCommittedTapTimestamp = MonotonicTime::now();
-        m_lastCommittedTapLocation = currentPotentialTapLocation;
-    };
-
     auto invalidTargetForSingleClick = !m_potentialTapNode;
     if (!invalidTargetForSingleClick) {
         bool targetRenders = m_potentialTapNode->renderer();
@@ -1098,10 +1080,8 @@
         invalidTargetForSingleClick = !targetRenders && !is<HTMLAreaElement>(m_potentialTapNode.get());
     }
     if (invalidTargetForSingleClick) {
-        // When the node has no click eventlistener, but it may have a dblclick one.
-        handlePotentialDoubleTapForDoubleClickAtPoint(modifiers, lastLayerTreeTransactionId);
         commitPotentialTapFailed();
-        return updateLastCommittedLocationAndTimestamp();
+        return;
     }
 
     FloatPoint adjustedPoint;
@@ -1110,7 +1090,7 @@
 
     if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad()) {
         commitPotentialTapFailed();
-        return updateLastCommittedLocationAndTimestamp();
+        return;
     }
 
     if (m_potentialTapNode == nodeRespondingToClick) {
@@ -1121,12 +1101,7 @@
             commitPotentialTapFailed();
         } else
 #endif
-        {
-            if (handlePotentialDoubleTapForDoubleClickAtPoint(modifiers, lastLayerTreeTransactionId))
-                commitPotentialTapFailed();
-            else
-                handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, pointerId);
-        }
+            handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, pointerId);
     } else
         commitPotentialTapFailed();
 
@@ -1133,7 +1108,6 @@
     m_potentialTapNode = nullptr;
     m_potentialTapLocation = FloatPoint();
     m_potentialTapSecurityOrigin = nullptr;
-    return updateLastCommittedLocationAndTimestamp();
 }
 
 void WebPage::commitPotentialTapFailed()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to