Title: [264481] trunk
Revision
264481
Author
[email protected]
Date
2020-07-16 14:59:33 -0700 (Thu, 16 Jul 2020)

Log Message

Selection is not always clearing when tapping.
https://bugs.webkit.org/show_bug.cgi?id=214326
Source/WebKit:

<rdar://problem/65069201>

Reviewed by Wenson Hsieh.

In r262280 we stopped the UIWKGestureOneFingerTap gesture from starting if the tap was not inside
the current selection. That caused the selection to not always be cleared, especially when tapping
on an element that could create an overlay in which the selection was supposed to be obscured. We
short circuited this gesture because it used to cause a sync IPC message to be sent to the web process,
but that code has subsequently changed, so allowing the gesture to start and clear the selection in all
cases is no longer a performance concern, so changing the behavior back to allowing the gesture to always
start, even if the touch is not inside the selection rect.

Test: editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html

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

LayoutTests:

Reviewed by Wenson Hsieh.

* editing/selection/ios/hide-selection-after-tap-on-prevent-default-element-expected.txt: Added.
* editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html: Added.
* resources/ui-helper.js:
(window.UIHelper.tapElement):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264480 => 264481)


--- trunk/LayoutTests/ChangeLog	2020-07-16 21:54:11 UTC (rev 264480)
+++ trunk/LayoutTests/ChangeLog	2020-07-16 21:59:33 UTC (rev 264481)
@@ -1,3 +1,15 @@
+2020-07-16  Megan Gardner  <[email protected]>
+
+        Selection is not always clearing when tapping.
+        https://bugs.webkit.org/show_bug.cgi?id=214326
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/selection/ios/hide-selection-after-tap-on-prevent-default-element-expected.txt: Added.
+        * editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html: Added.
+        * resources/ui-helper.js:
+        (window.UIHelper.tapElement):
+
 2020-07-16  Truitt Savell  <[email protected]>
 
         (r264469) [ Mac ] imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html is a flaky failure

Added: trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element-expected.txt (0 => 264481)


--- trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element-expected.txt	2020-07-16 21:59:33 UTC (rev 264481)
@@ -0,0 +1,11 @@
+HelloWorld
+
+Verifies that text selection is suppressed when tapping on a different element that prevents default. To manually run the test, select some text, and then tap the button below it. Platform selection views should disappear.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS selectionRects.length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html (0 => 264481)


--- trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html	2020-07-16 21:59:33 UTC (rev 264481)
@@ -0,0 +1,73 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+<script src=""
+<script src=""
+<style>
+body {
+    width: 100%;
+    height: 100%;
+    margin: 0;
+}
+
+#text {
+    width: 100%;
+    height: 100%;
+    font-size: 100px;
+    font: monospace;
+}
+
+#spacer {
+    width: 100%;
+    height: 200px;
+}
+
+
+#target {
+    width: 1em;
+    height: 1em;
+}
+
+input {
+    width: 320px;
+    height: 3em;
+}
+</style>
+<script>
+addEventListener("load", runTest);
+jsTestIsAsync = true;
+
+async function runTest() {
+    description("Verifies that text selection is suppressed when tapping on a different element that prevents default. To manually run the test, select some text, and then tap the button below it. Platform selection views should disappear.");
+
+    button = document.querySelector("input");
+    text = document.getElementById("text");
+    button.addEventListener("click", () => {
+        event.preventDefault();
+    });
+
+    if (!window.testRunner)
+        return;
+
+    await UIHelper.longPressElement(text);
+    await UIHelper.waitForSelectionToAppear();
+    await UIHelper.tapElement(text);
+    await UIHelper.activateElement(button);
+    await UIHelper.waitForSelectionToDisappear();
+    selectionRects = await UIHelper.getUISelectionViewRects();
+
+    shouldBe("selectionRects.length", "0");
+
+    finishJSTest();
+}
+</script>
+</head>
+<body>
+<div id="text">HelloWorld</div>
+<div id="spacer"></div>
+<input type="button" value="Press me">
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>

Modified: trunk/LayoutTests/resources/ui-helper.js (264480 => 264481)


--- trunk/LayoutTests/resources/ui-helper.js	2020-07-16 21:54:11 UTC (rev 264480)
+++ trunk/LayoutTests/resources/ui-helper.js	2020-07-16 21:59:33 UTC (rev 264481)
@@ -129,6 +129,13 @@
         });
     }
 
+    static tapElement(element, delay = 0)
+    {
+        const x = element.offsetLeft + (element.offsetWidth / 2);
+        const y = element.offsetTop + (element.offsetHeight / 2);
+        this.tapAt(x, y);
+    }
+
     static doubleTapElement(element, delay = 0)
     {
         const x = element.offsetLeft + (element.offsetWidth / 2);

Modified: trunk/Source/WebKit/ChangeLog (264480 => 264481)


--- trunk/Source/WebKit/ChangeLog	2020-07-16 21:54:11 UTC (rev 264480)
+++ trunk/Source/WebKit/ChangeLog	2020-07-16 21:59:33 UTC (rev 264481)
@@ -1,3 +1,24 @@
+2020-07-16  Megan Gardner  <[email protected]>
+
+        Selection is not always clearing when tapping.
+        https://bugs.webkit.org/show_bug.cgi?id=214326
+        <rdar://problem/65069201>
+
+        Reviewed by Wenson Hsieh.
+
+        In r262280 we stopped the UIWKGestureOneFingerTap gesture from starting if the tap was not inside
+        the current selection. That caused the selection to not always be cleared, especially when tapping
+        on an element that could create an overlay in which the selection was supposed to be obscured. We 
+        short circuited this gesture because it used to cause a sync IPC message to be sent to the web process,
+        but that code has subsequently changed, so allowing the gesture to start and clear the selection in all
+        cases is no longer a performance concern, so changing the behavior back to allowing the gesture to always
+        start, even if the touch is not inside the selection rect.
+
+        Test: editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
+
 2020-07-16  Eric Carlson  <[email protected]>
 
         Use AVRoutePickerView when available for choosing AirPlay devices

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (264480 => 264481)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-07-16 21:54:11 UTC (rev 264480)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-07-16 21:59:33 UTC (rev 264481)
@@ -2585,9 +2585,7 @@
                 return NO;
             }
             default:
-                if (!_page->editorState().selectionIsRange)
-                    return NO;
-                return [self _pointIsInsideSelectionRect:point outBoundingRect:nil];
+                return _page->editorState().selectionIsRange;
             }
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to