Title: [249550] branches/safari-608-branch
Revision
249550
Author
[email protected]
Date
2019-09-05 16:08:56 -0700 (Thu, 05 Sep 2019)

Log Message

Apply patch. rdar://problem/55001140

    Treat a two-finger single tap as if the user tapped with the Cmd key pressed https://bugs.webkit.org/show_bug.cgi?id=201420 <rdar://problem/53207786>

    Reviewed by Simon Fraser.

    Source/WebKit:

    Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
    correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
    if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.

    * UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView _twoFingerSingleTapGestureRecognized:]):

    Tools:

    Add a new twoFingerSingleTapAtPoint() method to UIScriptController, which just calls into the existing (but unused)
    -[HIDEventGenerator twoFingerTap:completionBlock:].

    * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
    * TestRunnerShared/UIScriptContext/UIScriptController.h:
    (WTR::UIScriptController::twoFingerSingleTapAtPoint):
    * WebKitTestRunner/ios/UIScriptControllerIOS.h:
    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
    (WTR::UIScriptControllerIOS::twoFingerSingleTapAtPoint):

    LayoutTests:

    Add a new event that checks that a two-finger single tap on a clickable element yields a "click" event with the metaKey flag set to true.

    * fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt: Added.
    * fast/events/ios/click-event-two-finger-single-tap-meta-key.html: Added.

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (249549 => 249550)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-09-05 23:08:56 UTC (rev 249550)
@@ -1,3 +1,52 @@
+2019-09-05  Kocsen Chung  <[email protected]>
+
+        Apply patch. rdar://problem/55001140
+
+    Treat a two-finger single tap as if the user tapped with the Cmd key pressed https://bugs.webkit.org/show_bug.cgi?id=201420 <rdar://problem/53207786>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebKit:
+    
+    Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
+    correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
+    if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
+    
+    Tools:
+    
+    Add a new twoFingerSingleTapAtPoint() method to UIScriptController, which just calls into the existing (but unused)
+    -[HIDEventGenerator twoFingerTap:completionBlock:].
+    
+    * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+    * TestRunnerShared/UIScriptContext/UIScriptController.h:
+    (WTR::UIScriptController::twoFingerSingleTapAtPoint):
+    * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::twoFingerSingleTapAtPoint):
+    
+    LayoutTests:
+    
+    Add a new event that checks that a two-finger single tap on a clickable element yields a "click" event with the metaKey flag set to true.
+    
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt: Added.
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key.html: Added.
+
+    2019-09-03  Antoine Quint  <[email protected]>
+
+            [iOS] Treat a two-finger single tap as if the user tapped with the Cmd key pressed
+            https://bugs.webkit.org/show_bug.cgi?id=201420
+            <rdar://problem/53207786>
+
+            Reviewed by Simon Fraser.
+
+            Add a new event that checks that a two-finger single tap on a clickable element yields a "click" event with the metaKey flag set to true.
+
+            * fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt: Added.
+            * fast/events/ios/click-event-two-finger-single-tap-meta-key.html: Added.
+
 2019-09-04  Kocsen Chung  <[email protected]>
 
         Cherry-pick r249368. rdar://problem/55001166

Added: branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt (0 => 249550)


--- branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt	2019-09-05 23:08:56 UTC (rev 249550)
@@ -0,0 +1 @@
+PASS: received click event with metaKey set to true

Added: branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key.html (0 => 249550)


--- branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/events/ios/click-event-two-finger-single-tap-meta-key.html	2019-09-05 23:08:56 UTC (rev 249550)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta name="viewport" content="width=device-width">
+    <script>
+
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return document.getElementById('ui-script').text;
+        }
+
+        function runTest()
+        {
+            if (testRunner.runUIScript)
+                testRunner.runUIScript(`(() => uiController.twoFingerSingleTapAtPoint(50, 50, () => uiController.uiScriptComplete()))()`);
+        }
+        
+        function boxClicked(event)
+        {
+            if (event.metaKey)
+                document.getElementById('target').textContent = 'PASS: received click event with metaKey set to true';
+            else
+                document.getElementById('target').textContent = 'FAIL: received click event with metaKey set to false';
+            testRunner.notifyDone();
+        }
+    </script>
+    <style>
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    </style>
+</head>
+<body _onload_="runTest()">
+
+<div id="target" _onclick_="boxClicked(event)">
+    FAIL: did not receive click event.
+</div>
+
+</body>
+</html>

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (249549 => 249550)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-05 23:08:56 UTC (rev 249550)
@@ -1,3 +1,54 @@
+2019-09-05  Kocsen Chung  <[email protected]>
+
+        Apply patch. rdar://problem/55001140
+
+    Treat a two-finger single tap as if the user tapped with the Cmd key pressed https://bugs.webkit.org/show_bug.cgi?id=201420 <rdar://problem/53207786>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebKit:
+    
+    Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
+    correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
+    if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
+    
+    Tools:
+    
+    Add a new twoFingerSingleTapAtPoint() method to UIScriptController, which just calls into the existing (but unused)
+    -[HIDEventGenerator twoFingerTap:completionBlock:].
+    
+    * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+    * TestRunnerShared/UIScriptContext/UIScriptController.h:
+    (WTR::UIScriptController::twoFingerSingleTapAtPoint):
+    * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::twoFingerSingleTapAtPoint):
+    
+    LayoutTests:
+    
+    Add a new event that checks that a two-finger single tap on a clickable element yields a "click" event with the metaKey flag set to true.
+    
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt: Added.
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key.html: Added.
+
+    2019-09-03  Antoine Quint  <[email protected]>
+
+            [iOS] Treat a two-finger single tap as if the user tapped with the Cmd key pressed
+            https://bugs.webkit.org/show_bug.cgi?id=201420
+            <rdar://problem/53207786>
+
+            Reviewed by Simon Fraser.
+
+            Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
+            correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
+            if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.
+
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
+
 2019-09-04  Kocsen Chung  <[email protected]>
 
         Cherry-pick r249430. rdar://problem/55027550

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (249549 => 249550)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-05 23:08:56 UTC (rev 249550)
@@ -2411,7 +2411,7 @@
 {
     _isTapHighlightIDValid = YES;
     _isExpectingFastSingleTapCommit = YES;
-    _page->handleTwoFingerTapAtPoint(WebCore::roundedIntPoint(gestureRecognizer.centroid), WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer)), ++_latestTapID);
+    _page->handleTwoFingerTapAtPoint(WebCore::roundedIntPoint(gestureRecognizer.centroid), WebKit::webEventModifierFlags(gestureRecognizerModifierFlags(gestureRecognizer) | UIKeyModifierCommand), ++_latestTapID);
 }
 
 - (void)_stylusSingleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer

Modified: branches/safari-608-branch/Tools/ChangeLog (249549 => 249550)


--- branches/safari-608-branch/Tools/ChangeLog	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-09-05 23:08:56 UTC (rev 249550)
@@ -1,3 +1,57 @@
+2019-09-05  Kocsen Chung  <[email protected]>
+
+        Apply patch. rdar://problem/55001140
+
+    Treat a two-finger single tap as if the user tapped with the Cmd key pressed https://bugs.webkit.org/show_bug.cgi?id=201420 <rdar://problem/53207786>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebKit:
+    
+    Set the metaKey modifier to true when generating a click event based on a two-finger single tap. This is important so that sites like Google and DuckDuckGo
+    correctly open links in their search results page in a new tab in Safari on iOS. This currently doesn't work because those sites will call preventDefault()
+    if the metaKey flag isn't set on a "click" event, and if it is set, they let the browser handle the navigation themselves.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
+    
+    Tools:
+    
+    Add a new twoFingerSingleTapAtPoint() method to UIScriptController, which just calls into the existing (but unused)
+    -[HIDEventGenerator twoFingerTap:completionBlock:].
+    
+    * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+    * TestRunnerShared/UIScriptContext/UIScriptController.h:
+    (WTR::UIScriptController::twoFingerSingleTapAtPoint):
+    * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::twoFingerSingleTapAtPoint):
+    
+    LayoutTests:
+    
+    Add a new event that checks that a two-finger single tap on a clickable element yields a "click" event with the metaKey flag set to true.
+    
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key-expected.txt: Added.
+    * fast/events/ios/click-event-two-finger-single-tap-meta-key.html: Added.
+
+    2019-09-03  Antoine Quint  <[email protected]>
+
+            [iOS] Treat a two-finger single tap as if the user tapped with the Cmd key pressed
+            https://bugs.webkit.org/show_bug.cgi?id=201420
+            <rdar://problem/53207786>
+
+            Reviewed by Simon Fraser.
+
+            Add a new twoFingerSingleTapAtPoint() method to UIScriptController, which just calls into the existing (but unused)
+            -[HIDEventGenerator twoFingerTap:completionBlock:].
+
+            * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+            * TestRunnerShared/UIScriptContext/UIScriptController.h:
+            (WTR::UIScriptController::twoFingerSingleTapAtPoint):
+            * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+            * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+            (WTR::UIScriptControllerIOS::twoFingerSingleTapAtPoint):
+
 2019-09-04  Kocsen Chung  <[email protected]>
 
         Cherry-pick r249368. rdar://problem/55001166

Modified: branches/safari-608-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (249549 => 249550)


--- branches/safari-608-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2019-09-05 23:08:56 UTC (rev 249550)
@@ -128,6 +128,10 @@
 {
 }
 
+void UIScriptController::twoFingerSingleTapAtPoint(long x, long y, JSValueRef callback)
+{
+}
+
 void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef callback)
 {
 }

Modified: branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (249549 => 249550)


--- branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2019-09-05 23:08:56 UTC (rev 249550)
@@ -57,6 +57,7 @@
     void liftUpAtPoint(long x, long y, long touchCount, object callback);
     void singleTapAtPoint(long x, long y, object callback);
     void singleTapAtPointWithModifiers(long x, long y, object modifierArray, object callback);
+    void twoFingerSingleTapAtPoint(long x, long y, object callback);
     void doubleTapAtPoint(long x, long y, object callback);
     void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, object callback);
 

Modified: branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (249549 => 249550)


--- branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2019-09-05 23:08:56 UTC (rev 249550)
@@ -83,6 +83,7 @@
     void liftUpAtPoint(long x, long y, long touchCount, JSValueRef callback);
     void singleTapAtPoint(long x, long y, JSValueRef callback);
     void singleTapAtPointWithModifiers(long x, long y, JSValueRef modifierArray, JSValueRef callback);
+    void twoFingerSingleTapAtPoint(long x, long y, JSValueRef callback);
     void doubleTapAtPoint(long x, long y, JSValueRef callback);
     void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback);
 

Modified: branches/safari-608-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (249549 => 249550)


--- branches/safari-608-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2019-09-05 23:03:32 UTC (rev 249549)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2019-09-05 23:08:56 UTC (rev 249550)
@@ -295,6 +295,18 @@
     }];
 }
 
+void UIScriptController::twoFingerSingleTapAtPoint(long x, long y, JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y);
+    [[HIDEventGenerator sharedHIDEventGenerator] twoFingerTap:location completionBlock:^{
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    }];
+}
+
 void UIScriptController::doubleTapAtPoint(long x, long y, JSValueRef callback)
 {
     unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to