[webkit-changes] [WebKit/WebKit] 457b73: [UIAsyncTextInput] Edit menu doesn't appear after ...

Wenson Hsieh noreply at github.com
Sat Nov 25 10:00:37 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 457b73ca23e9f18da1d4f827b8aa6dcf7ac7565c
      https://github.com/WebKit/WebKit/commit/457b73ca23e9f18da1d4f827b8aa6dcf7ac7565c
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-11-25 (Sat, 25 Nov 2023)

  Changed paths:
    M LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt
    M LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word.html
    M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm

  Log Message:
  -----------
  [UIAsyncTextInput] Edit menu doesn't appear after choosing "Select" in editable content
https://bugs.webkit.org/show_bug.cgi?id=265265
rdar://118726761

Reviewed by Aditya Keerthi.

Previously, `UIWKTextInteractionAssistant` would automatically present the edit menu after a 200 ms
delay, when invoking `-selectAll:` or `-selectWord`. These SPIs are no longer exposed on
`UIAsyncTextInteraction`, but we instead have the ability to directly request edit menu presentation
via `-presentEditMenuForSelection`.

This causes the layout test `editing/selection/ios/show-callout-bar-after-selecting-word.html` to
fail when using the async text input/interaction codepath. To fix this, we add logic to schedule
edit menu presentation 200 ms after the next selection change, after triggering `-selectWord` or
`-selectAll:`.

* LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word-expected.txt:
* LayoutTests/editing/selection/ios/show-callout-bar-after-selecting-word.html:

Also adjust this test to be more robust, by waiting for the edit menu to no longer contain "Select
All". This is because it's possible for the last step of the test:

```
await UIHelper.rectForMenuAction("Select All");
```

...to check the contents of the edit menu, before the internal collection view for the edit menu has
been reloaded since being shown for the caret selection. This currently causes the test to be flaky,
with or without `--use-async-uikit-interactions`, on some versions of iOS 17.

* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper dealloc]):
(-[WKTextInteractionWrapper deactivateSelection]):
(-[WKTextInteractionWrapper selectionChanged]):

Schedule a timer to present the edit menu after 200 ms, after the next selection change after
calling `-selectWord` or `-selectAll:`. See above for more details.

(-[WKTextInteractionWrapper selectWord]):
(-[WKTextInteractionWrapper selectAll:]):
(-[WKTextInteractionWrapper showEditMenuTimerFired]):
(-[WKTextInteractionWrapper stopShowEditMenuTimer]):

Canonical link: https://commits.webkit.org/271114@main




More information about the webkit-changes mailing list