Title: [279724] branches/safari-612.1.22.0-branch
Revision
279724
Author
[email protected]
Date
2021-07-08 09:32:08 -0700 (Thu, 08 Jul 2021)

Log Message

Cherry-pick r279562. rdar://problem/80327101

    [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
    https://bugs.webkit.org/show_bug.cgi?id=227666
    rdar://80094962

    Reviewed by Tim Horton.

    Source/WebKit:

    The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
    when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
    determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
    taps that were handled as meaningful clicks as well.

    To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
    delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
    in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
    tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
    synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
    result of the tap was "meaningfully" handled.

    To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
    call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
    however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.

    Tests:  fast/events/ios/did-not-handle-meaningful-click.html
            fast/events/ios/meaningful-click-when-focusing-body.html
            fast/events/ios/meaningful-click-when-playing-media.html
            fast/events/ios/non-meaningful-click-when-tapping-document.html

    * Shared/ios/TapHandlingResult.h: Added.

    Add a new C++ enum type to represent the tap handling result type (see description above).

    * UIProcess/API/APIUIClient.h:
    (API::UIClient::didTapAtPoint):
    (API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
    * UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
    * UIProcess/API/ios/WKWebViewIOS.h:
    * UIProcess/API/ios/WKWebViewIOS.mm:
    (wkTapHandlingResult):

    Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.

    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
    (-[WKWebView _didTapAtPoint:withResult:]):
    (-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
    * UIProcess/Cocoa/UIDelegate.h:
    * UIProcess/Cocoa/UIDelegate.mm:
    (WebKit::UIDelegate::setDelegate):
    (WebKit::UIDelegate::UIClient::didTapAtPoint):

    Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
    they have a chance to adopt the new SPI.

    (WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
    * UIProcess/PageClient.h:
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:

    Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
    and a flag indicating how the tap was handled by web content.

    * UIProcess/ios/PageClientImplIOS.h:
    * UIProcess/ios/PageClientImplIOS.mm:
    (WebKit::PageClientImpl::didTapAtPoint):
    (WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
    * UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::didTapAtPoint):
    (WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
    * WebKit.xcodeproj/project.pbxproj:
    * WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::WebPage::completeSyntheticClick):

    The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
    TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).

    (WebKit::WebPage::attemptSyntheticClick):
    (WebKit::WebPage::handleTwoFingerTapAtPoint):
    (WebKit::WebPage::commitPotentialTapFailed):

    Tools:

    Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
    WebKit/ChangeLog for more details.

    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
    (WTR::InjectedBundle::didReceiveMessageToPage):
    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
    (WTR::TestRunner::installDidHandleTapCallback):
    (WTR::TestRunner::callDidHandleTapCallback):
    (WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
    (WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.

    Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
    handled as a meaningful click.

    * WebKitTestRunner/InjectedBundle/TestRunner.h:
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::didHandleTap):
    (WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
    * WebKitTestRunner/TestController.h:
    * WebKitTestRunner/TestInvocation.cpp:
    (WTR::TestInvocation::didHandleTap):
    (WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
    * WebKitTestRunner/TestInvocation.h:
    * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
    (-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
    (-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.

    LayoutTests:

    Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
    we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.

    * fast/events/ios/did-not-handle-meaningful-click-expected.txt:
    * fast/events/ios/did-not-handle-meaningful-click.html:
    * fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
    * fast/events/ios/meaningful-click-when-focusing-body.html:
    * fast/events/ios/meaningful-click-when-playing-media-expected.txt:
    * fast/events/ios/meaningful-click-when-playing-media.html:
    * fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
    * fast/events/ios/non-meaningful-click-when-tapping-document.html:

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-612.1.22.0-branch/LayoutTests/ChangeLog (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/ChangeLog	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/ChangeLog	2021-07-08 16:32:08 UTC (rev 279724)
@@ -1,3 +1,156 @@
+2021-07-08  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r279562. rdar://problem/80327101
+
+    [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+    https://bugs.webkit.org/show_bug.cgi?id=227666
+    rdar://80094962
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
+    when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
+    determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
+    taps that were handled as meaningful clicks as well.
+    
+    To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
+    delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
+    in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
+    tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
+    synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
+    result of the tap was "meaningfully" handled.
+    
+    To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
+    call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
+    however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.
+    
+    Tests:  fast/events/ios/did-not-handle-meaningful-click.html
+            fast/events/ios/meaningful-click-when-focusing-body.html
+            fast/events/ios/meaningful-click-when-playing-media.html
+            fast/events/ios/non-meaningful-click-when-tapping-document.html
+    
+    * Shared/ios/TapHandlingResult.h: Added.
+    
+    Add a new C++ enum type to represent the tap handling result type (see description above).
+    
+    * UIProcess/API/APIUIClient.h:
+    (API::UIClient::didTapAtPoint):
+    (API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+    * UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
+    * UIProcess/API/ios/WKWebViewIOS.h:
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (wkTapHandlingResult):
+    
+    Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.
+    
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _didTapAtPoint:withResult:]):
+    (-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    * UIProcess/Cocoa/UIDelegate.h:
+    * UIProcess/Cocoa/UIDelegate.mm:
+    (WebKit::UIDelegate::setDelegate):
+    (WebKit::UIDelegate::UIClient::didTapAtPoint):
+    
+    Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
+    they have a chance to adopt the new SPI.
+    
+    (WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/PageClient.h:
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.messages.in:
+    
+    Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
+    and a flag indicating how the tap was handled by web content.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::didTapAtPoint):
+    (WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::didTapAtPoint):
+    (WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::completeSyntheticClick):
+    
+    The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
+    TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).
+    
+    (WebKit::WebPage::attemptSyntheticClick):
+    (WebKit::WebPage::handleTwoFingerTapAtPoint):
+    (WebKit::WebPage::commitPotentialTapFailed):
+    
+    Tools:
+    
+    Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
+    WebKit/ChangeLog for more details.
+    
+    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+    (WTR::InjectedBundle::didReceiveMessageToPage):
+    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+    (WTR::TestRunner::installDidHandleTapCallback):
+    (WTR::TestRunner::callDidHandleTapCallback):
+    (WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    (WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    
+    Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
+    handled as a meaningful click.
+    
+    * WebKitTestRunner/InjectedBundle/TestRunner.h:
+    * WebKitTestRunner/TestController.cpp:
+    (WTR::TestController::didHandleTap):
+    (WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestController.h:
+    * WebKitTestRunner/TestInvocation.cpp:
+    (WTR::TestInvocation::didHandleTap):
+    (WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestInvocation.h:
+    * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+    (-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
+    (-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    
+    LayoutTests:
+    
+    Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
+    we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.
+    
+    * fast/events/ios/did-not-handle-meaningful-click-expected.txt:
+    * fast/events/ios/did-not-handle-meaningful-click.html:
+    * fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
+    * fast/events/ios/meaningful-click-when-focusing-body.html:
+    * fast/events/ios/meaningful-click-when-playing-media-expected.txt:
+    * fast/events/ios/meaningful-click-when-playing-media.html:
+    * fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
+    * fast/events/ios/non-meaningful-click-when-tapping-document.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-07-04  Wenson Hsieh  <[email protected]>
+
+            [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+            https://bugs.webkit.org/show_bug.cgi?id=227666
+            rdar://80094962
+
+            Reviewed by Tim Horton.
+
+            Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
+            we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.
+
+            * fast/events/ios/did-not-handle-meaningful-click-expected.txt:
+            * fast/events/ios/did-not-handle-meaningful-click.html:
+            * fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
+            * fast/events/ios/meaningful-click-when-focusing-body.html:
+            * fast/events/ios/meaningful-click-when-playing-media-expected.txt:
+            * fast/events/ios/meaningful-click-when-playing-media.html:
+            * fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
+            * fast/events/ios/non-meaningful-click-when-tapping-document.html:
+
 2021-06-30  Alan Coon  <[email protected]>
 
         Cherry-pick r279382. rdar://problem/79970297

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click-expected.txt (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click-expected.txt	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click-expected.txt	2021-07-08 16:32:08 UTC (rev 279724)
@@ -2,11 +2,15 @@
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS didNotHandleTapAsMeaningfulClickCallback is true
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is false
 PASS clicked on button
-PASS didNotHandleTapAsMeaningfulClickCallback is false
-PASS didNotHandleTapAsMeaningfulClickCallback is true
-PASS didNotHandleTapAsMeaningfulClickCallback is false
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is true
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is false
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click.html (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click.html	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/did-not-handle-meaningful-click.html	2021-07-08 16:32:08 UTC (rev 279724)
@@ -22,32 +22,35 @@
     let text = document.getElementById("text");
     let button = document.getElementById("target");
 
-    async function simulateTapAndCheckDidNotHandleTapAsMeaningfulClick(element, expectation) {
-        didNotHandleTapAsMeaningfulClickCallback = false;
-        testRunner.installDidNotHandleTapAsMeaningfulClickCallback(() => {
-            didNotHandleTapAsMeaningfulClickCallback = true;
+    async function simulateTapAndCheckDidHandleTapAsMeaningfulClick(element, expectation) {
+        didHandleTap = false;
+        didHandleTapAsMeaningfulClick = false;
+        testRunner.installDidHandleTapCallback(wasMeaningful => {
+            didHandleTap = true;
+            didHandleTapAsMeaningfulClick = wasMeaningful;
         });
 
         await UIHelper.activateElement(element);
         await UIHelper.waitForDoubleTapDelay();
+        shouldBeTrue("didHandleTap");
         if (expectation)
-            shouldBeTrue("didNotHandleTapAsMeaningfulClickCallback");
+            shouldBeTrue("didHandleTapAsMeaningfulClick");
         else
-            shouldBeFalse("didNotHandleTapAsMeaningfulClickCallback");
+            shouldBeFalse("didHandleTapAsMeaningfulClick");
 
         testRunner.clearTestRunnerCallbacks();
     }
 
-    await simulateTapAndCheckDidNotHandleTapAsMeaningfulClick(text, true);
-    await simulateTapAndCheckDidNotHandleTapAsMeaningfulClick(button, false);
+    await simulateTapAndCheckDidHandleTapAsMeaningfulClick(text, false);
+    await simulateTapAndCheckDidHandleTapAsMeaningfulClick(button, true);
 
     document.body.addEventListener("click", () => { });
-    await simulateTapAndCheckDidNotHandleTapAsMeaningfulClick(text, true);
+    await simulateTapAndCheckDidHandleTapAsMeaningfulClick(text, false);
 
     document.body.addEventListener("mousedown", (event) => {
         event.preventDefault();
     });
-    await simulateTapAndCheckDidNotHandleTapAsMeaningfulClick(text, false);
+    await simulateTapAndCheckDidHandleTapAsMeaningfulClick(text, true);
 
     text.remove();
     button.remove();

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body-expected.txt (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body-expected.txt	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body-expected.txt	2021-07-08 16:32:08 UTC (rev 279724)
@@ -3,9 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS Focused body element
-PASS didDispatchNonMeaningfulClickCallback is false
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is true
 PASS Tapped inside body element
-PASS didDispatchNonMeaningfulClickCallback is false
+PASS didHandleTapAsMeaningfulClick is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body.html (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body.html	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-focusing-body.html	2021-07-08 16:32:08 UTC (rev 279724)
@@ -19,26 +19,31 @@
 addEventListener("load", async () => {
     description("This test exercises the 'meaningful click' heuristic in an editable body element, and requires WebKitTestRunner.");
 
-    didDispatchNonMeaningfulClickCallback = false;
-    testRunner.installDidNotHandleTapAsMeaningfulClickCallback(() => {
-        didDispatchNonMeaningfulClickCallback = true;
+    didHandleTap = false;
+    didHandleTapAsMeaningfulClick = false;
+    testRunner.installDidHandleTapCallback(wasMeaningful => {
+        didHandleTap = true;
+        didHandleTapAsMeaningfulClick = wasMeaningful;
     });
 
     await UIHelper.activateElementAndWaitForInputSession(document.body);
     await UIHelper.waitForDoubleTapDelay();
     testPassed("Focused body element");
-    shouldBeFalse("didDispatchNonMeaningfulClickCallback");
+    shouldBeTrue("didHandleTap");
+    shouldBeTrue("didHandleTapAsMeaningfulClick");
 
     testRunner.clearTestRunnerCallbacks();
-    didDispatchNonMeaningfulClickCallback = false;
-    testRunner.installDidNotHandleTapAsMeaningfulClickCallback(() => {
-        didDispatchNonMeaningfulClickCallback = true;
+    didHandleTap = false;
+    didHandleTapAsMeaningfulClick = false;
+    testRunner.installDidHandleTapCallback(wasMeaningful => {
+        didHandleTap = true;
+        didHandleTapAsMeaningfulClick = wasMeaningful;
     });
 
     await UIHelper.activateAt(100, 100);
     await UIHelper.waitForDoubleTapDelay();
     testPassed("Tapped inside body element");
-    shouldBeFalse("didDispatchNonMeaningfulClickCallback");
+    shouldBeTrue("didHandleTapAsMeaningfulClick");
 
     testRunner.clearTestRunnerCallbacks();
     document.getElementById("text").remove();

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media-expected.txt (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media-expected.txt	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media-expected.txt	2021-07-08 16:32:08 UTC (rev 279724)
@@ -3,9 +3,11 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS didPlayVideo became true
-PASS didDispatchNonMeaningfulClickCallback is false
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is true
 PASS didPauseVideo became true
-PASS didDispatchNonMeaningfulClickCallback is false
+PASS didHandleTap is true
+PASS didHandleTapAsMeaningfulClick is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media.html (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media.html	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/meaningful-click-when-playing-media.html	2021-07-08 16:32:08 UTC (rev 279724)
@@ -34,21 +34,24 @@
     if (!window.testRunner)
         return;
 
-    async function checkForNonMeaningfulClick(shouldPlay) {
-        didDispatchNonMeaningfulClickCallback = false;
-        testRunner.installDidNotHandleTapAsMeaningfulClickCallback(() => {
-            didDispatchNonMeaningfulClickCallback = true;
+    async function simulateTap(shouldPlay) {
+        didHandleTap = false;
+        didHandleTapAsMeaningfulClick = false;
+        testRunner.installDidHandleTapCallback(wasMeaningful => {
+            didHandleTap = true;
+            didHandleTapAsMeaningfulClick = wasMeaningful;
         });
 
         await UIHelper.activateElement(document.body);
         await UIHelper.waitForDoubleTapDelay();
         await new Promise(resolve => shouldBecomeEqual(shouldPlay ? "didPlayVideo" : "didPauseVideo", "true", resolve));
-        shouldBeFalse("didDispatchNonMeaningfulClickCallback");
+        shouldBeTrue("didHandleTap");
+        shouldBeTrue("didHandleTapAsMeaningfulClick");
         testRunner.clearTestRunnerCallbacks();
     }
 
-    await checkForNonMeaningfulClick(true);
-    await checkForNonMeaningfulClick(false);
+    await simulateTap(true);
+    await simulateTap(false);
     finishJSTest();
 });
 </script>

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt	2021-07-08 16:32:08 UTC (rev 279724)
@@ -3,7 +3,8 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS didDispatchClick became true
-PASS didDispatchNonMeaningfulClickCallback became true
+PASS didHandleTap became true
+PASS didHandleTapAsMeaningfulClick is false
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document.html (279723 => 279724)


--- branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document.html	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document.html	2021-07-08 16:32:08 UTC (rev 279724)
@@ -18,9 +18,11 @@
     if (!window.testRunner)
         return;
 
-    didDispatchNonMeaningfulClickCallback = false;
-    testRunner.installDidNotHandleTapAsMeaningfulClickCallback(() => {
-        didDispatchNonMeaningfulClickCallback = true;
+    didHandleTap = false;
+    didHandleTapAsMeaningfulClick = false;
+    testRunner.installDidHandleTapCallback(wasMeaningful => {
+        didHandleTap = true;
+        didHandleTapAsMeaningfulClick = wasMeaningful;
     });
 
     didDispatchClick = false;
@@ -31,7 +33,8 @@
     await UIHelper.activateAt(100, 100);
     await UIHelper.waitForDoubleTapDelay();
     await new Promise(resolve => shouldBecomeEqual("didDispatchClick", "true", resolve));
-    await new Promise(resolve => shouldBecomeEqual("didDispatchNonMeaningfulClickCallback", "true", resolve));
+    await new Promise(resolve => shouldBecomeEqual("didHandleTap", "true", resolve));
+    shouldBeFalse("didHandleTapAsMeaningfulClick");
 
     testRunner.clearTestRunnerCallbacks();
     finishJSTest();

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/ChangeLog (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/ChangeLog	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/ChangeLog	2021-07-08 16:32:08 UTC (rev 279724)
@@ -1,3 +1,218 @@
+2021-07-08  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r279562. rdar://problem/80327101
+
+    [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+    https://bugs.webkit.org/show_bug.cgi?id=227666
+    rdar://80094962
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
+    when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
+    determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
+    taps that were handled as meaningful clicks as well.
+    
+    To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
+    delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
+    in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
+    tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
+    synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
+    result of the tap was "meaningfully" handled.
+    
+    To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
+    call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
+    however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.
+    
+    Tests:  fast/events/ios/did-not-handle-meaningful-click.html
+            fast/events/ios/meaningful-click-when-focusing-body.html
+            fast/events/ios/meaningful-click-when-playing-media.html
+            fast/events/ios/non-meaningful-click-when-tapping-document.html
+    
+    * Shared/ios/TapHandlingResult.h: Added.
+    
+    Add a new C++ enum type to represent the tap handling result type (see description above).
+    
+    * UIProcess/API/APIUIClient.h:
+    (API::UIClient::didTapAtPoint):
+    (API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+    * UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
+    * UIProcess/API/ios/WKWebViewIOS.h:
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (wkTapHandlingResult):
+    
+    Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.
+    
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _didTapAtPoint:withResult:]):
+    (-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    * UIProcess/Cocoa/UIDelegate.h:
+    * UIProcess/Cocoa/UIDelegate.mm:
+    (WebKit::UIDelegate::setDelegate):
+    (WebKit::UIDelegate::UIClient::didTapAtPoint):
+    
+    Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
+    they have a chance to adopt the new SPI.
+    
+    (WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/PageClient.h:
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.messages.in:
+    
+    Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
+    and a flag indicating how the tap was handled by web content.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::didTapAtPoint):
+    (WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::didTapAtPoint):
+    (WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::completeSyntheticClick):
+    
+    The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
+    TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).
+    
+    (WebKit::WebPage::attemptSyntheticClick):
+    (WebKit::WebPage::handleTwoFingerTapAtPoint):
+    (WebKit::WebPage::commitPotentialTapFailed):
+    
+    Tools:
+    
+    Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
+    WebKit/ChangeLog for more details.
+    
+    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+    (WTR::InjectedBundle::didReceiveMessageToPage):
+    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+    (WTR::TestRunner::installDidHandleTapCallback):
+    (WTR::TestRunner::callDidHandleTapCallback):
+    (WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    (WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    
+    Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
+    handled as a meaningful click.
+    
+    * WebKitTestRunner/InjectedBundle/TestRunner.h:
+    * WebKitTestRunner/TestController.cpp:
+    (WTR::TestController::didHandleTap):
+    (WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestController.h:
+    * WebKitTestRunner/TestInvocation.cpp:
+    (WTR::TestInvocation::didHandleTap):
+    (WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestInvocation.h:
+    * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+    (-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
+    (-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    
+    LayoutTests:
+    
+    Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
+    we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.
+    
+    * fast/events/ios/did-not-handle-meaningful-click-expected.txt:
+    * fast/events/ios/did-not-handle-meaningful-click.html:
+    * fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
+    * fast/events/ios/meaningful-click-when-focusing-body.html:
+    * fast/events/ios/meaningful-click-when-playing-media-expected.txt:
+    * fast/events/ios/meaningful-click-when-playing-media.html:
+    * fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
+    * fast/events/ios/non-meaningful-click-when-tapping-document.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-07-04  Wenson Hsieh  <[email protected]>
+
+            [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+            https://bugs.webkit.org/show_bug.cgi?id=227666
+            rdar://80094962
+
+            Reviewed by Tim Horton.
+
+            The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
+            when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
+            determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
+            taps that were handled as meaningful clicks as well.
+
+            To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
+            delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
+            in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
+            tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
+            synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
+            result of the tap was "meaningfully" handled.
+
+            To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
+            call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
+            however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.
+
+            Tests:  fast/events/ios/did-not-handle-meaningful-click.html
+                    fast/events/ios/meaningful-click-when-focusing-body.html
+                    fast/events/ios/meaningful-click-when-playing-media.html
+                    fast/events/ios/non-meaningful-click-when-tapping-document.html
+
+            * Shared/ios/TapHandlingResult.h: Added.
+
+            Add a new C++ enum type to represent the tap handling result type (see description above).
+
+            * UIProcess/API/APIUIClient.h:
+            (API::UIClient::didTapAtPoint):
+            (API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+            * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+            * UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
+            * UIProcess/API/ios/WKWebViewIOS.h:
+            * UIProcess/API/ios/WKWebViewIOS.mm:
+            (wkTapHandlingResult):
+
+            Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.
+
+            * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+            * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+            (-[WKWebView _didTapAtPoint:withResult:]):
+            (-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+            * UIProcess/Cocoa/UIDelegate.h:
+            * UIProcess/Cocoa/UIDelegate.mm:
+            (WebKit::UIDelegate::setDelegate):
+            (WebKit::UIDelegate::UIClient::didTapAtPoint):
+
+            Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
+            they have a chance to adopt the new SPI.
+
+            (WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+            * UIProcess/PageClient.h:
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+
+            Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
+            and a flag indicating how the tap was handled by web content.
+
+            * UIProcess/ios/PageClientImplIOS.h:
+            * UIProcess/ios/PageClientImplIOS.mm:
+            (WebKit::PageClientImpl::didTapAtPoint):
+            (WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::didTapAtPoint):
+            (WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+            * WebKit.xcodeproj/project.pbxproj:
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::WebPage::completeSyntheticClick):
+
+            The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
+            TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).
+
+            (WebKit::WebPage::attemptSyntheticClick):
+            (WebKit::WebPage::handleTwoFingerTapAtPoint):
+            (WebKit::WebPage::commitPotentialTapFailed):
+
 2021-07-07  Ruben Turcios  <[email protected]>
 
         Cherry-pick r279591. rdar://problem/80282918

Added: branches/safari-612.1.22.0-branch/Source/WebKit/Shared/ios/TapHandlingResult.h (0 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/Shared/ios/TapHandlingResult.h	                        (rev 0)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/Shared/ios/TapHandlingResult.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(IOS_FAMILY)
+
+#include <wtf/EnumTraits.h>
+
+namespace WebKit {
+
+enum class TapHandlingResult : uint8_t  {
+    DidNotHandleTapAsClick,
+    NonMeaningfulClick,
+    MeaningfulClick,
+};
+
+} // namespace WebKit
+
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::TapHandlingResult> {
+    using values = EnumValues <
+    WebKit::TapHandlingResult,
+    WebKit::TapHandlingResult::DidNotHandleTapAsClick,
+    WebKit::TapHandlingResult::NonMeaningfulClick,
+    WebKit::TapHandlingResult::MeaningfulClick
+    >;
+};
+
+} // namespace WTF
+
+#endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/APIUIClient.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/APIUIClient.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/APIUIClient.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -52,6 +52,7 @@
 }
 
 namespace WebKit {
+enum class TapHandlingResult : uint8_t;
 class NativeWebKeyboardEvent;
 class NativeWebWheelEvent;
 class UserMediaPermissionRequestProxy;
@@ -163,7 +164,7 @@
 #endif
     virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) { return defaultActions; }
     virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }
-    virtual void didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint&) { }
+    virtual void didTapAtPoint(const WebCore::IntPoint&, WebKit::TapHandlingResult) { }
     virtual UIViewController *presentingViewController() { return nullptr; }
 #endif
 #if PLATFORM(COCOA)

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -28,6 +28,7 @@
 #import <WebKit/WKUIDelegate.h>
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/_WKActivatedElementInfo.h>
+#import <WebKit/_WKTapHandlingResult.h>
 #import <WebKit/_WKWebAuthenticationPanel.h>
 
 @class NSData;
@@ -164,7 +165,8 @@
 - (BOOL)_webView:(WKWebView *)webView shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(9.0));
 - (NSArray *)_webView:(WKWebView *)webView actionsForElement:(_WKActivatedElementInfo *)element defaultActions:(NSArray<_WKElementAction *> *)defaultActions;
 - (void)_webView:(WKWebView *)webView didNotHandleTapAsClickAtPoint:(CGPoint)point;
-- (void)_webView:(WKWebView *)webView didNotHandleTapAsMeaningfulClickAtPoint:(CGPoint)point WK_API_AVAILABLE(ios(15.0));
+- (void)_webView:(WKWebView *)webView didNotHandleTapAsMeaningfulClickAtPoint:(CGPoint)point WK_API_DEPRECATED_WITH_REPLACEMENT("_webView:didTapAtPoint:withResult:", ios(15.0, 15.0));
+- (void)_webView:(WKWebView *)webView didTapAtPoint:(CGPoint)point withResult:(_WKTapHandlingResult)result WK_API_AVAILABLE(ios(15.0));
 - (void)_webView:(WKWebView *)webView requestGeolocationAuthorizationForURL:(NSURL *)url frame:(WKFrameInfo *)frame decisionHandler:(void (^)(BOOL authorized))decisionHandler WK_API_AVAILABLE(ios(11.0));
 - (BOOL)_webView:(WKWebView *)webView fileUploadPanelContentIsManagedWithInitiatingFrame:(WKFrameInfo *)frame;
 

Added: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKTapHandlingResult.h (0 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKTapHandlingResult.h	                        (rev 0)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKTapHandlingResult.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETfindeHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if TARGET_OS_IPHONE
+
+typedef NS_ENUM(NSInteger, _WKTapHandlingResult) {
+    _WKTapHandlingResultDidNotHandleTapAsClick,
+    _WKTapHandlingResultNonMeaningfulClick,
+    _WKTapHandlingResultMeaningfulClick,
+} WK_API_AVAILABLE(ios(15.0));
+
+#endif // TARGET_OS_IPHONE

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -24,11 +24,16 @@
  */
 
 #import "WKWebViewInternal.h"
+#import "_WKTapHandlingResult.h"
 
 @class UIScrollEvent;
 
 #if PLATFORM(IOS_FAMILY)
 
+namespace WebKit {
+enum class TapHandlingResult : uint8_t;
+}
+
 @interface WKWebView (WKViewInternalIOS)
 
 - (void)_setupScrollAndContentViews;
@@ -149,4 +154,6 @@
 
 @end
 
+_WKTapHandlingResult wkTapHandlingResult(WebKit::TapHandlingResult);
+
 #endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -35,6 +35,7 @@
 #import "RemoteLayerTreeScrollingPerformanceData.h"
 #import "RemoteLayerTreeViews.h"
 #import "RemoteScrollingCoordinatorProxy.h"
+#import "TapHandlingResult.h"
 #import "VideoFullscreenManagerProxy.h"
 #import "ViewGestureController.h"
 #import "WKBackForwardListItemInternal.h"
@@ -3374,4 +3375,18 @@
 
 #undef WKWEBVIEW_RELEASE_LOG
 
+_WKTapHandlingResult wkTapHandlingResult(WebKit::TapHandlingResult result)
+{
+    switch (result) {
+    case WebKit::TapHandlingResult::DidNotHandleTapAsClick:
+        return _WKTapHandlingResultDidNotHandleTapAsClick;
+    case WebKit::TapHandlingResult::NonMeaningfulClick:
+        return _WKTapHandlingResultNonMeaningfulClick;
+    case WebKit::TapHandlingResult::MeaningfulClick:
+        return _WKTapHandlingResultMeaningfulClick;
+    }
+    ASSERT_NOT_REACHED();
+    return _WKTapHandlingResultDidNotHandleTapAsClick;
+}
+
 #endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -25,6 +25,7 @@
 
 #import <WebKit/WKWebView.h>
 #import <WebKit/_WKElementAction.h>
+#import <WebKit/_WKTapHandlingResult.h>
 
 #if TARGET_OS_IPHONE
 
@@ -64,7 +65,7 @@
 - (void)_didFinishTextInteractionInTextInputContext:(_WKTextInputContext *)context;
 - (void)_requestDocumentContext:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler;
 - (void)_adjustSelectionWithDelta:(NSRange)deltaRange completionHandler:(void (^)(void))completionHandler;
-- (void)_didNotHandleTapAsMeaningfulClickAtPoint:(CGPoint)point;
+- (void)_didTapAtPoint:(CGPoint)point withResult:(_WKTapHandlingResult)result;
 
 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
 - (double)timePickerValueHour;

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -96,7 +96,7 @@
 #endif
 }
 
-- (void)_didNotHandleTapAsMeaningfulClickAtPoint:(CGPoint)point
+- (void)_didTapAtPoint:(CGPoint)point withResult:(_WKTapHandlingResult)result
 {
     // For subclasses to override.
 }

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -48,6 +48,8 @@
 
 namespace WebKit {
 
+enum class TapHandlingResult : uint8_t;
+
 class UIDelegate : public CanMakeWeakPtr<UIDelegate> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -144,7 +146,7 @@
 #endif
         RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) final;
         void didNotHandleTapAsClick(const WebCore::IntPoint&) final;
-        void didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint&) final;
+        void didTapAtPoint(const WebCore::IntPoint&, WebKit::TapHandlingResult) final;
         UIViewController *presentingViewController() final;
 #endif // PLATFORM(IOS_FAMILY)
 
@@ -239,6 +241,7 @@
         bool webViewActionsForElementDefaultActions : 1;
         bool webViewDidNotHandleTapAsClickAtPoint : 1;
         bool webViewDidNotHandleTapAsMeaningfulClickAtPoint : 1;
+        bool webViewDidTapAtPointWithResult : 1;
         bool presentingViewControllerForWebView : 1;
 #endif
         bool dataDetectionContextForWebView : 1;

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -35,6 +35,7 @@
 #import "MediaUtilities.h"
 #import "NativeWebWheelEvent.h"
 #import "NavigationActionData.h"
+#import "TapHandlingResult.h"
 #import "UserMediaPermissionCheckProxy.h"
 #import "UserMediaPermissionRequestManagerProxy.h"
 #import "UserMediaPermissionRequestProxy.h"
@@ -47,6 +48,7 @@
 #import "WKStorageAccessAlert.h"
 #import <WebKit/WKUIDelegatePrivate.h>
 #import "WKWebViewConfigurationInternal.h"
+#import "WKWebViewIOS.h"
 #import "WKWebViewInternal.h"
 #import "WKWindowFeaturesInternal.h"
 #import "WebEventFactory.h"
@@ -158,6 +160,7 @@
     m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
     m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
     m_delegateMethods.webViewDidNotHandleTapAsMeaningfulClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsMeaningfulClickAtPoint:)];
+    m_delegateMethods.webViewDidTapAtPointWithResult = [delegate respondsToSelector:@selector(_webView:didTapAtPoint:withResult:)];
     m_delegateMethods.presentingViewControllerForWebView = [delegate respondsToSelector:@selector(_presentingViewControllerForWebView:)];
 #endif
     m_delegateMethods.webViewIsMediaCaptureAuthorizedForFrameDecisionHandler = [delegate respondsToSelector:@selector(_webView:checkUserMediaPermissionForURL:mainFrameURL:frameIdentifier:decisionHandler:)] || [delegate respondsToSelector:@selector(_webView:includeSensitiveMediaDeviceDetails:)];
@@ -1412,19 +1415,23 @@
     [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate->m_webView.get().get() didNotHandleTapAsClickAtPoint:point];
 }
 
-void UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint& point)
+void UIDelegate::UIClient::didTapAtPoint(const WebCore::IntPoint& point, WebKit::TapHandlingResult result)
 {
     if (!m_uiDelegate)
         return;
 
-    if (!m_uiDelegate->m_delegateMethods.webViewDidNotHandleTapAsMeaningfulClickAtPoint)
-        return;
-
     auto delegate = m_uiDelegate->m_delegate.get();
     if (!delegate)
         return;
 
-    [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate->m_webView.get().get() didNotHandleTapAsMeaningfulClickAtPoint:point];
+    if (m_uiDelegate->m_delegateMethods.webViewDidTapAtPointWithResult)
+        [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate->m_webView.get().get() didTapAtPoint:point withResult:wkTapHandlingResult(result)];
+
+    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+    // FIXME: Remove this once all internal clients adopt -_webView:didTapAtPoint:withResult:.
+    if (m_uiDelegate->m_delegateMethods.webViewDidNotHandleTapAsMeaningfulClickAtPoint && result != WebKit::TapHandlingResult::MeaningfulClick)
+        [static_cast<id <WKUIDelegatePrivate>>(delegate) _webView:m_uiDelegate->m_webView.get().get() didNotHandleTapAsMeaningfulClickAtPoint:point];
+    ALLOW_DEPRECATED_DECLARATIONS_END
 }
 
 UIViewController *UIDelegate::UIClient::presentingViewController()

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/PageClient.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/PageClient.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/PageClient.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -137,6 +137,7 @@
 namespace WebKit {
 
 enum class UndoOrRedo : bool;
+enum class TapHandlingResult : uint8_t;
 
 class ContextMenuContextData;
 class DownloadProxy;
@@ -337,7 +338,7 @@
 #endif
 #if PLATFORM(IOS_FAMILY)
     virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) = 0;
-    virtual void didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint&) = 0;
+    virtual void didTapAtPoint(const WebCore::IntPoint&, TapHandlingResult) = 0;
     virtual void didCompleteSyntheticClick() = 0;
 #endif
 

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -403,6 +403,7 @@
 struct WebSpeechSynthesisVoice;
 
 enum class ImageAnalysisType : uint8_t;
+enum class TapHandlingResult : uint8_t;
 enum class TextRecognitionUpdateResult : uint8_t;
 enum class NegotiatedLegacyTLS : bool;
 enum class ProcessSwapRequestedByClient : bool;
@@ -833,7 +834,7 @@
     void applicationWillEnterForegroundForMedia();
     void commitPotentialTapFailed();
     void didNotHandleTapAsClick(const WebCore::IntPoint&);
-    void didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint&);
+    void didTapAtPoint(const WebCore::IntPoint&, TapHandlingResult);
     void didCompleteSyntheticClick();
     void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
     void handleSmartMagnificationInformationForPotentialTap(uint64_t requestID, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel);

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-07-08 16:32:08 UTC (rev 279724)
@@ -170,7 +170,7 @@
     ShowPlaybackTargetPicker(bool hasVideo, WebCore::IntRect elementRect, enum:uint8_t WebCore::RouteSharingPolicy policy, String routingContextUID)
     CommitPotentialTapFailed()
     DidNotHandleTapAsClick(WebCore::IntPoint point)
-    DidNotHandleTapAsMeaningfulClickAtPoint(WebCore::IntPoint point)
+    DidTapAtPoint(WebCore::IntPoint point, enum:uint8_t WebKit::TapHandlingResult result)
     DidCompleteSyntheticClick()
     DisableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID)
     HandleSmartMagnificationInformationForPotentialTap(uint64_t requestID, WebCore::FloatRect renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel)

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -246,7 +246,7 @@
     void didFailNavigation(API::Navigation*) override;
     void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
     void didNotHandleTapAsClick(const WebCore::IntPoint&) override;
-    void didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint&) final;
+    void didTapAtPoint(const WebCore::IntPoint&, TapHandlingResult) final;
     void didCompleteSyntheticClick() override;
 
     void runModalJavaScriptDialog(CompletionHandler<void()>&& callback) final;

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -40,6 +40,7 @@
 #import "NavigationState.h"
 #import "RunningBoardServicesSPI.h"
 #import "StringUtilities.h"
+#import "TapHandlingResult.h"
 #import "UIKitSPI.h"
 #import "UndoOrRedo.h"
 #import "ViewSnapshotStore.h"
@@ -233,9 +234,9 @@
     [m_contentView _didNotHandleTapAsClick:point];
 }
 
-void PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint& point)
+void PageClientImpl::didTapAtPoint(const WebCore::IntPoint& point, TapHandlingResult result)
 {
-    [m_webView _didNotHandleTapAsMeaningfulClickAtPoint:point];
+    [m_webView _didTapAtPoint:point withResult:wkTapHandlingResult(result)];
 }
 
 void PageClientImpl::didCompleteSyntheticClick()

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -49,6 +49,7 @@
 #import "RemoteLayerTreeTransaction.h"
 #import "RemoteScrollingCoordinatorProxy.h"
 #import "ShareableResource.h"
+#import "TapHandlingResult.h"
 #import "UIKitSPI.h"
 #import "UserData.h"
 #import "UserInterfaceIdiom.h"
@@ -1009,10 +1010,10 @@
     m_uiClient->didNotHandleTapAsClick(point);
 }
 
-void WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint(const WebCore::IntPoint& point)
+void WebPageProxy::didTapAtPoint(const WebCore::IntPoint& point, TapHandlingResult result)
 {
-    pageClient().didNotHandleTapAsMeaningfulClickAtPoint(point);
-    m_uiClient->didNotHandleTapAsMeaningfulClickAtPoint(point);
+    pageClient().didTapAtPoint(point, result);
+    m_uiClient->didTapAtPoint(point, result);
 }
     
 void WebPageProxy::didCompleteSyntheticClick()

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-07-08 16:32:08 UTC (rev 279724)
@@ -2040,6 +2040,8 @@
 		F4CF1E9D25E40DCC000F9D73 /* GestureRecognizerConsistencyEnforcer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4CF1E9B25E40DCC000F9D73 /* GestureRecognizerConsistencyEnforcer.h */; };
 		F4D5F51D206087A10038BBA8 /* WKTextInputListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */; };
 		F4D5F51F206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F51B206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h */; };
+		F4D985C82690FC1200BBCCBE /* _WKTapHandlingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D985C72690FBEF00BBCCBE /* _WKTapHandlingResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		F4D985CB2691096600BBCCBE /* TapHandlingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */; };
 		F4DB54E62319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */; };
 		F4EC94E32356CC57000BB614 /* ApplicationServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */; };
 		F4FE0A3B24632B60002631E1 /* CocoaColor.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FE0A3A24632B10002631E1 /* CocoaColor.h */; };
@@ -6017,8 +6019,10 @@
 		F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTextInputListViewController.h; path = ios/forms/WKTextInputListViewController.h; sourceTree = "<group>"; };
 		F4D5F51A206087A10038BBA8 /* WKTextInputListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTextInputListViewController.mm; path = ios/forms/WKTextInputListViewController.mm; sourceTree = "<group>"; };
 		F4D5F51B206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKQuickboardViewControllerDelegate.h; path = ios/forms/WKQuickboardViewControllerDelegate.h; sourceTree = "<group>"; };
+		F4D985C72690FBEF00BBCCBE /* _WKTapHandlingResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKTapHandlingResult.h; sourceTree = "<group>"; };
 		F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKHighlightLongPressGestureRecognizer.h; path = ios/WKHighlightLongPressGestureRecognizer.h; sourceTree = "<group>"; };
 		F4DB54E52319E733009E3155 /* WKHighlightLongPressGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKHighlightLongPressGestureRecognizer.mm; path = ios/WKHighlightLongPressGestureRecognizer.mm; sourceTree = "<group>"; };
+		F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TapHandlingResult.h; path = ios/TapHandlingResult.h; sourceTree = "<group>"; };
 		F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSelectMenuListViewController.mm; path = ios/forms/WKSelectMenuListViewController.mm; sourceTree = "<group>"; };
 		F4F59AD42065A5CA006CAA46 /* WKSelectMenuListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKSelectMenuListViewController.h; path = ios/forms/WKSelectMenuListViewController.h; sourceTree = "<group>"; };
 		F4FE0A3A24632B10002631E1 /* CocoaColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CocoaColor.h; sourceTree = "<group>"; };
@@ -7718,6 +7722,7 @@
 				1C9EBA5B2087E74E00054429 /* NativeWebMouseEventIOS.mm */,
 				2DA944981884E4F000ED86DB /* NativeWebTouchEventIOS.mm */,
 				4459984122833E6000E61373 /* SyntheticEditingCommandType.h */,
+				F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */,
 				E38A1FBE23A5511400D2374F /* UserInterfaceIdiom.h */,
 				E38A1FBF23A551BF00D2374F /* UserInterfaceIdiom.mm */,
 				F40D1B68220BDC0F00B49A01 /* WebAutocorrectionContext.h */,
@@ -8080,6 +8085,7 @@
 				1A002D3F196B329400B9AD44 /* _WKSessionState.h */,
 				1A002D3E196B329400B9AD44 /* _WKSessionState.mm */,
 				1A002D42196B337000B9AD44 /* _WKSessionStateInternal.h */,
+				F4D985C72690FBEF00BBCCBE /* _WKTapHandlingResult.h */,
 				2DE9B1382231F61C005287B7 /* _WKTextInputContext.h */,
 				2DE9B1372231F61C005287B7 /* _WKTextInputContext.mm */,
 				2DE9B13B2231F77C005287B7 /* _WKTextInputContextInternal.h */,
@@ -11765,6 +11771,7 @@
 				376311FE1A3FB600005A2E51 /* _WKSameDocumentNavigationTypeInternal.h in Headers */,
 				1A002D44196B338900B9AD44 /* _WKSessionState.h in Headers */,
 				1A002D43196B337000B9AD44 /* _WKSessionStateInternal.h in Headers */,
+				F4D985C82690FC1200BBCCBE /* _WKTapHandlingResult.h in Headers */,
 				2DE9B13A2231F61C005287B7 /* _WKTextInputContext.h in Headers */,
 				2DE9B13C2231F77C005287B7 /* _WKTextInputContextInternal.h in Headers */,
 				9B5499AD2362A6F900DF8BA5 /* _WKTextManipulationConfiguration.h in Headers */,
@@ -12363,6 +12370,7 @@
 				448AC24E267135A700B28921 /* SynapseSPI.h in Headers */,
 				4459984222833E8700E61373 /* SyntheticEditingCommandType.h in Headers */,
 				3157135F2040A9B20084F9CF /* SystemPreviewController.h in Headers */,
+				F4D985CB2691096600BBCCBE /* TapHandlingResult.h in Headers */,
 				44C51844266BE8C4006DD522 /* TCCSoftLink.h in Headers */,
 				CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */,
 				1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */,

Modified: branches/safari-612.1.22.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -45,6 +45,7 @@
 #import "ShareableBitmapUtilities.h"
 #import "SharedMemory.h"
 #import "SyntheticEditingCommandType.h"
+#import "TapHandlingResult.h"
 #import "TextCheckingControllerProxy.h"
 #import "UIKitSPI.h"
 #import "UserData.h"
@@ -902,24 +903,23 @@
     if (m_isClosed)
         return;
 
-    bool shouldDispatchDidNotHandleTapAsMeaningfulClickAtPoint = ([&] {
+    auto tapHandlingResult = ([&] {
         if (!m_currentSyntheticClickMayNotBeMeaningful)
-            return false;
+            return TapHandlingResult::MeaningfulClick;
 
         if (oldFocusedElement != newFocusedElement)
-            return false;
+            return TapHandlingResult::MeaningfulClick;
 
         if (is<HTMLTextFormControlElement>(nodeRespondingToClick) || nodeRespondingToClick.hasEditableStyle())
-            return false;
+            return TapHandlingResult::MeaningfulClick;
 
         if (isProbablyMeaningfulClick(nodeRespondingToClick))
-            return false;
+            return TapHandlingResult::MeaningfulClick;
 
-        return true;
+        return TapHandlingResult::NonMeaningfulClick;
     })();
 
-    if (shouldDispatchDidNotHandleTapAsMeaningfulClickAtPoint)
-        send(Messages::WebPageProxy::DidNotHandleTapAsMeaningfulClickAtPoint(roundedIntPoint(location)));
+    send(Messages::WebPageProxy::DidTapAtPoint(roundedIntPoint(location), tapHandlingResult));
 
     if (!tapWasHandled || !nodeRespondingToClick.isElementNode())
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location)));
@@ -935,7 +935,7 @@
     IntPoint adjustedIntPoint = roundedIntPoint(adjustedPoint);
 
     if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad()) {
-        send(Messages::WebPageProxy::DidNotHandleTapAsMeaningfulClickAtPoint(adjustedIntPoint));
+        send(Messages::WebPageProxy::DidTapAtPoint(adjustedIntPoint, TapHandlingResult::DidNotHandleTapAsClick));
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(adjustedIntPoint));
     } else if (m_interactionNode == nodeRespondingToClick)
         completeSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers, WebCore::OneFingerTap);
@@ -1143,7 +1143,7 @@
     Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint);
     if (!nodeRespondingToClick || !nodeRespondingToClick->renderer()) {
         auto adjustedIntPoint = roundedIntPoint(adjustedPoint);
-        send(Messages::WebPageProxy::DidNotHandleTapAsMeaningfulClickAtPoint(adjustedIntPoint));
+        send(Messages::WebPageProxy::DidTapAtPoint(adjustedIntPoint, TapHandlingResult::DidNotHandleTapAsClick));
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(adjustedIntPoint));
         return;
     }
@@ -1221,7 +1221,7 @@
     send(Messages::WebPageProxy::CommitPotentialTapFailed());
 
     auto adjustedIntPoint = roundedIntPoint(m_potentialTapLocation);
-    send(Messages::WebPageProxy::DidNotHandleTapAsMeaningfulClickAtPoint(adjustedIntPoint));
+    send(Messages::WebPageProxy::DidTapAtPoint(adjustedIntPoint, TapHandlingResult::DidNotHandleTapAsClick));
     send(Messages::WebPageProxy::DidNotHandleTapAsClick(adjustedIntPoint));
 }
 

Modified: branches/safari-612.1.22.0-branch/Tools/ChangeLog (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/ChangeLog	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/ChangeLog	2021-07-08 16:32:08 UTC (rev 279724)
@@ -1,3 +1,172 @@
+2021-07-08  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r279562. rdar://problem/80327101
+
+    [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+    https://bugs.webkit.org/show_bug.cgi?id=227666
+    rdar://80094962
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    The private UI delegate method `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` is currently only invoked
+    when a tap was not handled as a "meaningful" synthetic click (where the notion of "meaningful" is heuristically
+    determined). However, in order to support revised tab pill minimization behaviors, Safari requires knowledge of
+    taps that were handled as meaningful clicks as well.
+    
+    To support this, replace what is currently `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` with another
+    delegate method, `-_webView:didTapAtPoint:withResult:`, that is always invoked when a tap gesture is recognized
+    in the web view. The `result` parameter, a new `_WKTapHandlingResult` enum, then indicates to the client how the
+    tap was handled; this currently includes 3 values: one to indicate that the tap gesture did not result in a
+    synthetic click being dispatched, and two more to indicate whether the synthetic click that was dispatched as a
+    result of the tap was "meaningfully" handled.
+    
+    To facilitate the transition from `-_webView:didNotHandleTapAsMeaningfulClickAtPoint:` to the new SPI, we still
+    call the old SPI as long as the tap handling result type is not equal to TapHandlingResult::MeaningfulClick;
+    however, mark the old SPI as deprecated with `-_webView:didTapAtPoint:withResult:` as the replacement.
+    
+    Tests:  fast/events/ios/did-not-handle-meaningful-click.html
+            fast/events/ios/meaningful-click-when-focusing-body.html
+            fast/events/ios/meaningful-click-when-playing-media.html
+            fast/events/ios/non-meaningful-click-when-tapping-document.html
+    
+    * Shared/ios/TapHandlingResult.h: Added.
+    
+    Add a new C++ enum type to represent the tap handling result type (see description above).
+    
+    * UIProcess/API/APIUIClient.h:
+    (API::UIClient::didTapAtPoint):
+    (API::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+    * UIProcess/API/Cocoa/_WKTapHandlingResult.h: Added.
+    * UIProcess/API/ios/WKWebViewIOS.h:
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (wkTapHandlingResult):
+    
+    Add a helper method to convert from the WebKit::TapHandlingResult enum to the SPI-exposed _WKTapHandlingResult.
+    
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _didTapAtPoint:withResult:]):
+    (-[WKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    * UIProcess/Cocoa/UIDelegate.h:
+    * UIProcess/Cocoa/UIDelegate.mm:
+    (WebKit::UIDelegate::setDelegate):
+    (WebKit::UIDelegate::UIClient::didTapAtPoint):
+    
+    Note that we still invoke the old UI delegate SPI here to ensure that these changes don't break Safari before
+    they have a chance to adopt the new SPI.
+    
+    (WebKit::UIDelegate::UIClient::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/PageClient.h:
+    * UIProcess/WebPageProxy.h:
+    * UIProcess/WebPageProxy.messages.in:
+    
+    Replace the `DidNotHandleTapAsMeaningfulClickAtPoint` message with `DidTapAtPoint`, which takes both a location
+    and a flag indicating how the tap was handled by web content.
+    
+    * UIProcess/ios/PageClientImplIOS.h:
+    * UIProcess/ios/PageClientImplIOS.mm:
+    (WebKit::PageClientImpl::didTapAtPoint):
+    (WebKit::PageClientImpl::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::didTapAtPoint):
+    (WebKit::WebPageProxy::didNotHandleTapAsMeaningfulClickAtPoint): Deleted.
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::completeSyntheticClick):
+    
+    The meaningful tap heuristic no longer determines whether we send an IPC message or not, but rather the type of
+    TapHandlingResult to send (namely, whether to send NonMeaningfulClick or MeaningfulClick).
+    
+    (WebKit::WebPage::attemptSyntheticClick):
+    (WebKit::WebPage::handleTwoFingerTapAtPoint):
+    (WebKit::WebPage::commitPotentialTapFailed):
+    
+    Tools:
+    
+    Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
+    WebKit/ChangeLog for more details.
+    
+    * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+    (WTR::InjectedBundle::didReceiveMessageToPage):
+    * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+    (WTR::TestRunner::installDidHandleTapCallback):
+    (WTR::TestRunner::callDidHandleTapCallback):
+    (WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    (WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+    
+    Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
+    handled as a meaningful click.
+    
+    * WebKitTestRunner/InjectedBundle/TestRunner.h:
+    * WebKitTestRunner/TestController.cpp:
+    (WTR::TestController::didHandleTap):
+    (WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestController.h:
+    * WebKitTestRunner/TestInvocation.cpp:
+    (WTR::TestInvocation::didHandleTap):
+    (WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
+    * WebKitTestRunner/TestInvocation.h:
+    * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+    (-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
+    (-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+    
+    LayoutTests:
+    
+    Update the existing layout tests. The new UI delegate method should now be invoked in all of the cases; however,
+    we should only observe meaningful clicks in some of the below scenarios. See WebKit/ChangeLog for more details.
+    
+    * fast/events/ios/did-not-handle-meaningful-click-expected.txt:
+    * fast/events/ios/did-not-handle-meaningful-click.html:
+    * fast/events/ios/meaningful-click-when-focusing-body-expected.txt:
+    * fast/events/ios/meaningful-click-when-focusing-body.html:
+    * fast/events/ios/meaningful-click-when-playing-media-expected.txt:
+    * fast/events/ios/meaningful-click-when-playing-media.html:
+    * fast/events/ios/non-meaningful-click-when-tapping-document-expected.txt:
+    * fast/events/ios/non-meaningful-click-when-tapping-document.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-07-04  Wenson Hsieh  <[email protected]>
+
+            [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps
+            https://bugs.webkit.org/show_bug.cgi?id=227666
+            rdar://80094962
+
+            Reviewed by Tim Horton.
+
+            Update the layout test harness to use the replacement SPI instead of the newly deprecated SPI. See
+            WebKit/ChangeLog for more details.
+
+            * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+            * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+            (WTR::InjectedBundle::didReceiveMessageToPage):
+            * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+            (WTR::TestRunner::installDidHandleTapCallback):
+            (WTR::TestRunner::callDidHandleTapCallback):
+            (WTR::TestRunner::installDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+            (WTR::TestRunner::callDidNotHandleTapAsMeaningfulClickCallback): Deleted.
+
+            Rename this to just DidHandleTapCallback, and make it take a boolean argument indicating whether the tap was
+            handled as a meaningful click.
+
+            * WebKitTestRunner/InjectedBundle/TestRunner.h:
+            * WebKitTestRunner/TestController.cpp:
+            (WTR::TestController::didHandleTap):
+            (WTR::TestController::didNotHandleTapAsMeaningfulClick): Deleted.
+            * WebKitTestRunner/TestController.h:
+            * WebKitTestRunner/TestInvocation.cpp:
+            (WTR::TestInvocation::didHandleTap):
+            (WTR::TestInvocation::didNotHandleTapAsMeaningfulClick): Deleted.
+            * WebKitTestRunner/TestInvocation.h:
+            * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+            (-[TestRunnerWKWebView _didTapAtPoint:withResult:]):
+            (-[TestRunnerWKWebView _didNotHandleTapAsMeaningfulClickAtPoint:]): Deleted.
+
 2021-07-06  Ruben Turcios  <[email protected]>
 
         Cherry-pick r279449. rdar://problem/80212096

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2021-07-08 16:32:08 UTC (rev 279724)
@@ -258,7 +258,7 @@
     object neverInlineFunction(object function);
 
     // UI delegate hooks.
-    undefined installDidNotHandleTapAsMeaningfulClickCallback(object callback);
+    undefined installDidHandleTapCallback(object callback);
 
     // Swipe gestures
     undefined installDidBeginSwipeCallback(object callback);

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2021-07-08 16:32:08 UTC (rev 279724)
@@ -265,8 +265,10 @@
         return;
     }
 
-    if (WKStringIsEqualToUTF8CString(messageName, "CallDidNotHandleTapAsMeaningfulClickCallback")) {
-        m_testRunner->callDidNotHandleTapAsMeaningfulClickCallback();
+    if (WKStringIsEqualToUTF8CString(messageName, "CallDidHandleTapCallback")) {
+        ASSERT(messageBody);
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        m_testRunner->callDidHandleTapCallback(WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody)));
         return;
     }
 

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2021-07-08 16:32:08 UTC (rev 279724)
@@ -646,7 +646,7 @@
     EnterFullscreenForElementCallbackID,
     ExitFullscreenForElementCallbackID,
     AppBoundRequestContextDataForDomainCallbackID,
-    DidNotHandleTapAsMeaningfulClickCallbackID,
+    DidHandleTapCallbackID,
     FirstUIScriptCallbackID = 100
 };
 
@@ -1107,14 +1107,15 @@
     }));
 }
 
-void TestRunner::installDidNotHandleTapAsMeaningfulClickCallback(JSValueRef callback)
+void TestRunner::installDidHandleTapCallback(JSValueRef callback)
 {
-    cacheTestRunnerCallback(DidNotHandleTapAsMeaningfulClickCallbackID, callback);
+    cacheTestRunnerCallback(DidHandleTapCallbackID, callback);
 }
 
-void TestRunner::callDidNotHandleTapAsMeaningfulClickCallback()
+void TestRunner::callDidHandleTapCallback(bool wasMeaningful)
 {
-    callTestRunnerCallback(DidNotHandleTapAsMeaningfulClickCallbackID);
+    auto result = JSValueMakeBoolean(mainFrameJSContext(), wasMeaningful);
+    callTestRunnerCallback(DidHandleTapCallbackID, 1, &result);
 }
 
 void TestRunner::installDidBeginSwipeCallback(JSValueRef callback)

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -345,8 +345,8 @@
     void installCustomMenuAction(JSStringRef name, bool dismissesAutomatically, JSValueRef callback);
     void performCustomMenuAction();
 
-    void installDidNotHandleTapAsMeaningfulClickCallback(JSValueRef);
-    void callDidNotHandleTapAsMeaningfulClickCallback();
+    void installDidHandleTapCallback(JSValueRef);
+    void callDidHandleTapCallback(bool wasMeaningful);
 
     void installDidBeginSwipeCallback(JSValueRef);
     void installWillEndSwipeCallback(JSValueRef);

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.cpp (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.cpp	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.cpp	2021-07-08 16:32:08 UTC (rev 279724)
@@ -2212,9 +2212,9 @@
         exit(1);
 }
 
-void TestController::didNotHandleTapAsMeaningfulClick()
+void TestController::didHandleTap(bool wasMeaningful)
 {
-    m_currentInvocation->didNotHandleTapAsMeaningfulClick();
+    m_currentInvocation->didHandleTap(wasMeaningful);
 }
 
 void TestController::didBeginNavigationGesture(WKPageRef)

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestController.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -363,7 +363,7 @@
     void completeMediaKeySystemPermissionCheck(WKMediaKeySystemPermissionCallbackRef);
     void setIsMediaKeySystemPermissionGranted(bool);
 
-    void didNotHandleTapAsMeaningfulClick();
+    void didHandleTap(bool wasMeaningful);
 
 private:
     WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(const TestOptions&);

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.cpp (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.cpp	2021-07-08 16:32:08 UTC (rev 279724)
@@ -1445,9 +1445,10 @@
     m_textOutput.append(text);
 }
 
-void TestInvocation::didNotHandleTapAsMeaningfulClick()
+void TestInvocation::didHandleTap(bool wasMeaningful)
 {
-    postPageMessage("CallDidNotHandleTapAsMeaningfulClickCallback");
+    auto messageBody = adoptWK(WKBooleanCreate(wasMeaningful));
+    postPageMessage("CallDidHandleTapCallback", messageBody);
 }
 
 void TestInvocation::didBeginSwipe()

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.h (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.h	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/TestInvocation.h	2021-07-08 16:32:08 UTC (rev 279724)
@@ -64,7 +64,7 @@
     static void dumpWebProcessUnresponsiveness(const char* errorMessage);
     void outputText(const String&);
 
-    void didNotHandleTapAsMeaningfulClick();
+    void didHandleTap(bool wasMeaningful);
 
     void didBeginSwipe();
     void willEndSwipe();

Modified: branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (279723 => 279724)


--- branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm	2021-07-08 16:29:15 UTC (rev 279723)
+++ branches/safari-612.1.22.0-branch/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm	2021-07-08 16:32:08 UTC (rev 279724)
@@ -399,9 +399,9 @@
         self.didDismissPopoverCallback();
 }
 
-- (void)_didNotHandleTapAsMeaningfulClickAtPoint:(CGPoint)point
+- (void)_didTapAtPoint:(CGPoint)point withResult:(_WKTapHandlingResult)result
 {
-    WTR::TestController::singleton().didNotHandleTapAsMeaningfulClick();
+    WTR::TestController::singleton().didHandleTap(result == _WKTapHandlingResultMeaningfulClick);
 }
 
 - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to