[webkit-changes] [WebKit/WebKit] bee60e: [UIAsyncTextInputClient] Adopt delegate methods to...

Wenson Hsieh noreply at github.com
Thu Nov 9 11:12:53 PST 2023


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

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm

  Log Message:
  -----------
  [UIAsyncTextInputClient] Adopt delegate methods to provide text context for the edit menu
https://bugs.webkit.org/show_bug.cgi?id=264452
rdar://118145278

Reviewed by Aditya Keerthi.

Implement `-selectTextForContextMenuWithLocationInView:completionHandler:`, refactoring the
underlying implementation to share code with `-prepareSelectionForContextMenuWithLocationInView:`.

Additionally, remove our reliance on `_isPreparingEditMenu`, which is currently used to prevent the
edit menu from containing certain actions (Select All, Insert) when the selection is ranged.
Instead, to know whether or not the action is for the edit menu, we check whether the sender is a
`UIKeyCommand` (which is the case, even when using the edit menu) and it's happening outside of the
context of interpreting key events.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
(-[WKContentView requestRVItemInSelectedRangeWithCompletionHandler:]):
(-[WKContentView prepareSelectionForContextMenuWithLocationInView:completionHandler:]):
(-[WKContentView _internalSelectTextForContextMenuWithLocationInView:completionHandler:]):
(-[WKContentView selectTextForContextMenuWithLocationInView:completionHandler:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:

Update this test to properly exercise edit menu presentation, by passing in a `UIKeyCommand` as the
sender.

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




More information about the webkit-changes mailing list