Title: [241171] trunk
Revision
241171
Author
[email protected]
Date
2019-02-07 16:49:14 -0800 (Thu, 07 Feb 2019)

Log Message

[iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
https://bugs.webkit.org/show_bug.cgi?id=194415
<rdar://problem/47550281>

Reviewed by Tim Horton.

Source/WebKit:

Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images
are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with
the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs.

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

LayoutTests:

Add a layout test to verify that a stylus tap dispatches clicks.

* fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt: Added.
* fast/events/touch/ios/pencil-tap-dispatches-click.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241170 => 241171)


--- trunk/LayoutTests/ChangeLog	2019-02-08 00:45:34 UTC (rev 241170)
+++ trunk/LayoutTests/ChangeLog	2019-02-08 00:49:14 UTC (rev 241171)
@@ -1,3 +1,16 @@
+2019-02-07  Wenson Hsieh  <[email protected]>
+
+        [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
+        https://bugs.webkit.org/show_bug.cgi?id=194415
+        <rdar://problem/47550281>
+
+        Reviewed by Tim Horton.
+
+        Add a layout test to verify that a stylus tap dispatches clicks.
+
+        * fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt: Added.
+        * fast/events/touch/ios/pencil-tap-dispatches-click.html: Added.
+
 2019-02-07  Youenn Fablet  <[email protected]>
 
         Filter out Overconstrainederror.constraint when getUserMedia is not granted

Added: trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt (0 => 241171)


--- trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click-expected.txt	2019-02-08 00:49:14 UTC (rev 241171)
@@ -0,0 +1,7 @@
+PASS
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Verifies that tapping an element with a stylus dispatches a click event. To manually test, tap the black square above and check that the text in the square reads 'PASS'.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Added: trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click.html (0 => 241171)


--- trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/pencil-tap-dispatches-click.html	2019-02-08 00:49:14 UTC (rev 241171)
@@ -0,0 +1,51 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<meta name="viewport" content="initial-scale=1, width=device-width">
+<head>
+    <script src=""
+    <style>
+        body {
+            margin: none;
+        }
+
+        #target {
+            border: 1px black solid;
+            width: 200px;
+            height: 200px;
+        }
+    </style>
+</head>
+<body>
+    <div id="target">FAIL</div>
+    <div id="console"></div>
+    <p id="description"></p>
+    <script>
+        description("Verifies that tapping an element with a stylus dispatches a click event. To manually test, tap the black square above and check that the text in the square reads 'PASS'.");
+        jsTestIsAsync = true;
+
+        function tapUsingStylus(x, y) {
+            return new Promise(resolve => {
+                testRunner.runUIScript(`(() => {
+                    uiController.stylusDownAtPoint(${x}, ${y}, 0, 0, 0, () => { });
+                    uiController.stylusUpAtPoint(${x}, ${y}, () => uiController.uiScriptComplete());
+                })()`, resolve);
+            })
+        }
+
+        async function runTest() {
+            if (window.testRunner)
+                await tapUsingStylus(100, 100);
+        }
+
+        const target = document.getElementById("target");
+        target.addEventListener("click", () => {
+            target.textContent = "PASS";
+            finishJSTest();
+        });
+
+        addEventListener("load", runTest, false);
+    </script>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (241170 => 241171)


--- trunk/Source/WebKit/ChangeLog	2019-02-08 00:45:34 UTC (rev 241170)
+++ trunk/Source/WebKit/ChangeLog	2019-02-08 00:49:14 UTC (rev 241171)
@@ -1,3 +1,19 @@
+2019-02-07  Wenson Hsieh  <[email protected]>
+
+        [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
+        https://bugs.webkit.org/show_bug.cgi?id=194415
+        <rdar://problem/47550281>
+
+        Reviewed by Tim Horton.
+
+        Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images
+        are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with
+        the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView gestureRecognizerShouldBegin:]):
+        (-[WKContentView _stylusSingleTapRecognized:]):
+
 2019-02-07  Per Arne Vollan  <[email protected]>
 
         [macOS] Block coreservicesd in sandbox.

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (241170 => 241171)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-02-08 00:45:34 UTC (rev 241170)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-02-08 00:49:14 UTC (rev 241171)
@@ -1830,6 +1830,9 @@
 {
     CGPoint point = [gestureRecognizer locationInView:self];
 
+    if (gestureRecognizer == _stylusSingleTapGestureRecognizer)
+        return _webView._stylusTapGestureShouldCreateEditableImage;
+
     if (gestureRecognizer == _highlightLongPressGestureRecognizer
         || gestureRecognizer == _doubleTapGestureRecognizer
         || gestureRecognizer == _nonBlockingDoubleTapGestureRecognizer
@@ -2076,9 +2079,7 @@
 
 - (void)_stylusSingleTapRecognized:(UITapGestureRecognizer *)gestureRecognizer
 {
-    if (!_webView._stylusTapGestureShouldCreateEditableImage)
-        return;
-
+    ASSERT(_webView._stylusTapGestureShouldCreateEditableImage);
     ASSERT(gestureRecognizer == _stylusSingleTapGestureRecognizer);
     _page->handleStylusSingleTapAtPoint(WebCore::roundedIntPoint(gestureRecognizer.location), ++_latestTapID);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to