Title: [281420] trunk
Revision
281420
Author
[email protected]
Date
2021-08-22 14:26:45 -0700 (Sun, 22 Aug 2021)

Log Message

[iOS] Fix and reenable several layout tests to account for the changes in rdar://80384564
https://bugs.webkit.org/show_bug.cgi?id=229316

Reviewed by Tim Horton.

Source/WebKit:

After rdar://80384564, UIKit's non-editable text tap recognizer will no longer cause us to clear the active text
selection range when tapping outside of currently selected text in the page. Instead, WebKit's synthetic click
gesture recognizer should now manages clearing the selection (unless the page has prevented the "mousedown"
event).

With just the UIKit-side change, this already mostly works as expected since `commitPotentialTapFailed()` clears
out non-editable selections. However, there is one scenario in which we do want to clear out the selection when
tapping that isn't covered by the synthetic click gesture: when tapping on an element that does not handle or
prevent "mousedown"; this behavior is exercised by the existing layout test
`editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html`. To preserve this behavior, we
add a call to `clearSelectionAfterTapIfNeeded()` when completing a synthetic click, in the case where the
"mousedown" event was not swallowed.

These 3 tests should pass after the changes in rdar://80384564:
- editing/selection/ios/change-selection-by-tapping-with-existing-selection.html
- editing/selection/preserve-selection-when-clicking-button.html
- editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html

And these WebKit-side changes are needed to keep these 2 tests passing:
- editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html
- fast/images/text-recognition/ios/reselect-word-in-image-overlay.html

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):

LayoutTests:

See WebKit/ChangeLog for more details.

* fast/images/text-recognition/ios/reselect-word-in-image-overlay.html:

Add a short delay to avoid timing out, due to the second long press gesture to select text not triggering.

* platform/ios-14/TestExpectations:

Remove iOS 14-specific PASS expectations, and remove the more generic FAIL expectation in the ios directory.
Instead, just mark these three layout tests as FAIL on iOS 15, and PASS elsewhere.

* platform/ios-15/TestExpectations: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281419 => 281420)


--- trunk/LayoutTests/ChangeLog	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/LayoutTests/ChangeLog	2021-08-22 21:26:45 UTC (rev 281420)
@@ -1,3 +1,24 @@
+2021-08-22  Wenson Hsieh  <[email protected]>
+
+        [iOS] Fix and reenable several layout tests to account for the changes in rdar://80384564
+        https://bugs.webkit.org/show_bug.cgi?id=229316
+
+        Reviewed by Tim Horton.
+
+        See WebKit/ChangeLog for more details.
+
+        * fast/images/text-recognition/ios/reselect-word-in-image-overlay.html:
+
+        Add a short delay to avoid timing out, due to the second long press gesture to select text not triggering.
+
+        * platform/ios-14/TestExpectations:
+
+        Remove iOS 14-specific PASS expectations, and remove the more generic FAIL expectation in the ios directory.
+        Instead, just mark these three layout tests as FAIL on iOS 15, and PASS elsewhere.
+
+        * platform/ios-15/TestExpectations: Added.
+        * platform/ios/TestExpectations:
+
 2021-08-22  Myles C. Maxfield  <[email protected]>
 
         Control characters (Unicode category Cc) should be rendered visibly

Modified: trunk/LayoutTests/fast/images/text-recognition/ios/reselect-word-in-image-overlay.html (281419 => 281420)


--- trunk/LayoutTests/fast/images/text-recognition/ios/reselect-word-in-image-overlay.html	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/LayoutTests/fast/images/text-recognition/ios/reselect-word-in-image-overlay.html	2021-08-22 21:26:45 UTC (rev 281420)
@@ -39,6 +39,7 @@
     shouldBe("selectionRects.length", "1");
 
     await UIHelper.activateAt(200, 300);
+    await UIHelper.waitForDoubleTapDelay();
     await UIHelper.waitForSelectionToDisappear();
     testPassed("Dismissed selection");
 

Modified: trunk/LayoutTests/platform/ios/TestExpectations (281419 => 281420)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-08-22 21:26:45 UTC (rev 281420)
@@ -3380,10 +3380,6 @@
 # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
 http/wpt/mediarecorder/pause-recording.html [ Pass Crash ]
 
-#Batch adding of test expectations group 3:
-#rdar://80384177 ([ iOS15 ] editing/selection/ios/change-selection-by-tapping-with-existing-selection.html is failing)
-editing/selection/ios/change-selection-by-tapping-with-existing-selection.html  [ Failure ]
-
 #rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
 editing/selection/ios/select-text-in-existing-selection.html  [ Failure ]
 
@@ -3415,12 +3411,6 @@
 # rdar://80386075 ([ iOS15 ] fast/css/ios/system-color-for-css-value.html)
 fast/css/ios/system-color-for-css-value.html [ Failure ]
 
-# rdar://80385521 ([ iOS15 ] editing/selection/preserve-selection-when-clicking-button.html is a consistent failure)
-editing/selection/preserve-selection-when-clicking-button.html [ Failure ]
-
-# rdar://80384564 ([ iOS15 ] editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html is failing)
-editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html [ Failure ]
-
 # rdar://77070325 (REGRESSION: [ iOS15 ] imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-flipY.html is flaky failling)
 imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-flipY.html [ Pass Failure ]
 

Modified: trunk/LayoutTests/platform/ios-14/TestExpectations (281419 => 281420)


--- trunk/LayoutTests/platform/ios-14/TestExpectations	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/LayoutTests/platform/ios-14/TestExpectations	2021-08-22 21:26:45 UTC (rev 281420)
@@ -42,9 +42,6 @@
 # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
 http/wpt/mediarecorder/pause-recording.html [ Pass ]
 
-#rdar://80384177 ([ iOS15 ] editing/selection/ios/change-selection-by-tapping-with-existing-selection.html is failing)
-editing/selection/ios/change-selection-by-tapping-with-existing-selection.html  [ Pass ]
-
 #rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
 editing/selection/ios/select-text-in-existing-selection.html  [ Pass ]
 
@@ -78,12 +75,6 @@
 # rdar://80386075 ([ iOS15 ] fast/css/ios/system-color-for-css-value.html)
 fast/css/ios/system-color-for-css-value.html [ Pass ]
 
-# rdar://80385521 ([ iOS15 ] editing/selection/preserve-selection-when-clicking-button.html is a consistent failure)
-editing/selection/preserve-selection-when-clicking-button.html [ Pass ]
-
-# rdar://80384564 ([ iOS15 ] editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html is failing)
-editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html [ Pass ]
-
 # rdar://77070325 (REGRESSION: [ iOS15 ] imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-flipY.html is flaky failling)
 imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-flipY.html [ Pass ]
 

Added: trunk/LayoutTests/platform/ios-15/TestExpectations (0 => 281420)


--- trunk/LayoutTests/platform/ios-15/TestExpectations	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-15/TestExpectations	2021-08-22 21:26:45 UTC (rev 281420)
@@ -0,0 +1,4 @@
+# These three tests will be fixed by rdar://80384564.
+editing/selection/ios/change-selection-by-tapping-with-existing-selection.html  [ Failure ]
+editing/selection/preserve-selection-when-clicking-button.html [ Failure ]
+editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html [ Failure ]

Modified: trunk/Source/WebKit/ChangeLog (281419 => 281420)


--- trunk/Source/WebKit/ChangeLog	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/Source/WebKit/ChangeLog	2021-08-22 21:26:45 UTC (rev 281420)
@@ -1,3 +1,35 @@
+2021-08-22  Wenson Hsieh  <[email protected]>
+
+        [iOS] Fix and reenable several layout tests to account for the changes in rdar://80384564
+        https://bugs.webkit.org/show_bug.cgi?id=229316
+
+        Reviewed by Tim Horton.
+
+        After rdar://80384564, UIKit's non-editable text tap recognizer will no longer cause us to clear the active text
+        selection range when tapping outside of currently selected text in the page. Instead, WebKit's synthetic click
+        gesture recognizer should now manages clearing the selection (unless the page has prevented the "mousedown"
+        event).
+
+        With just the UIKit-side change, this already mostly works as expected since `commitPotentialTapFailed()` clears
+        out non-editable selections. However, there is one scenario in which we do want to clear out the selection when
+        tapping that isn't covered by the synthetic click gesture: when tapping on an element that does not handle or
+        prevent "mousedown"; this behavior is exercised by the existing layout test
+        `editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html`. To preserve this behavior, we
+        add a call to `clearSelectionAfterTapIfNeeded()` when completing a synthetic click, in the case where the
+        "mousedown" event was not swallowed.
+
+        These 3 tests should pass after the changes in rdar://80384564:
+        - editing/selection/ios/change-selection-by-tapping-with-existing-selection.html
+        - editing/selection/preserve-selection-when-clicking-button.html
+        - editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html
+
+        And these WebKit-side changes are needed to keep these 2 tests passing:
+        - editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html
+        - fast/images/text-recognition/ios/reselect-word-in-image-overlay.html
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::completeSyntheticClick):
+
 2021-08-22  Simon Fraser  <[email protected]>
 
         Use the strongly typed PageGroupIdentifier in place of uint64_t

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


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-08-22 21:04:49 UTC (rev 281419)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-08-22 21:26:45 UTC (rev 281420)
@@ -836,7 +836,6 @@
 
     SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true };
 
-    bool tapWasHandled = false;
     m_lastInteractionLocation = roundedAdjustedPoint;
 
     // FIXME: Pass caps lock state.
@@ -845,14 +844,16 @@
     bool altKey = modifiers.contains(WebEvent::Modifier::AltKey);
     bool metaKey = modifiers.contains(WebEvent::Modifier::MetaKey);
 
-    tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, syntheticClickType, pointerId));
+    bool handledPress = mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, syntheticClickType, pointerId));
     if (m_isClosed)
         return;
 
     if (auto selectionChangedHandler = std::exchange(m_selectionChangedHandler, {}))
         selectionChangedHandler();
+    else if (!handledPress)
+        clearSelectionAfterTapIfNeeded();
 
-    tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, syntheticClickType, pointerId));
+    bool handledRelease = mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, syntheticClickType, pointerId));
     if (m_isClosed)
         return;
 
@@ -871,7 +872,7 @@
     if (m_isClosed)
         return;
 
-    if (!tapWasHandled || !nodeRespondingToClick.isElementNode())
+    if ((!handledPress && !handledRelease) || !nodeRespondingToClick.isElementNode())
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location)));
 
     send(Messages::WebPageProxy::DidCompleteSyntheticClick());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to