[webkit-changes] [WebKit/WebKit] a81c6d: [UIAsyncTextInput] Adopt APIs to delete, move and ...

Wenson Hsieh noreply at github.com
Mon Nov 13 14:28:30 PST 2023


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

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  [UIAsyncTextInput] Adopt APIs to delete, move and extend the selection
https://bugs.webkit.org/show_bug.cgi?id=264711
rdar://118304457

Reviewed by Aditya Keerthi.

Adopt the following methods for moving or extending the selection, or deleting text:

```
@protocol UIAsyncTextInput
- (void)deleteInDirection:(UITextStorageDirection)direction toGranularity:(UITextGranularity)granularity;
- (void)moveInDirection:(UITextStorageDirection)direction byGranularity:(UITextGranularity)granularity;
- (void)extendInDirection:(UITextStorageDirection)direction byGranularity:(UITextGranularity)granularity;
- (void)moveInLayoutDirection:(UITextLayoutDirection)direction;
- (void)extendInLayoutDirection:(UITextLayoutDirection)direction;
@end
```

This takes the place of the following SPI and IPI selectors in UIKit:

```
-_deleteByWord
-_deleteForwardByWord
-_deleteToStartOfLine
-_deleteToEndOfLine
-_deleteToEndOfParagraph
-_deleteForwardAndNotify:
-_moveUp:withHistory:
-_moveDown:withHistory:
-_moveLeft:withHistory:
-_moveRight:withHistory:
-_moveToStartOfWord:withHistory:
-_moveToStartOfParagraph:withHistory:
-_moveToStartOfLine:withHistory:
-_moveToStartOfDocument:withHistory:
-_moveToEndOfWord:withHistory:
-_moveToEndOfParagraph:withHistory:
-_moveToEndOfLine:withHistory:
-_moveToEndOfDocument:withHistory:
```

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Add staging declarations for the new API methods.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformAction:withSender:]):
(-[WKContentView cutForWebView:]):
(-[WKContentView toggleBoldfaceForWebView:]):
(-[WKContentView toggleItalicsForWebView:]):
(-[WKContentView toggleUnderlineForWebView:]):
(-[WKContentView _executeEditCommand:]):

Rename `-executeEditCommandWithCallback:` to `-_executeEditCommand:`; the existing name is a bit
misleading, since it doesn't take a callback.

(-[WKContentView _deleteByWord]):
(-[WKContentView _deleteForwardByWord]):
(-[WKContentView _deleteToStartOfLine]):
(-[WKContentView _deleteToEndOfLine]):
(-[WKContentView _deleteForwardAndNotify:]):
(-[WKContentView _deleteToEndOfParagraph]):
(-[WKContentView _transpose]):
(-[WKContentView _moveUp:withHistory:]):
(-[WKContentView _moveDown:withHistory:]):
(-[WKContentView _moveLeft:withHistory:]):
(-[WKContentView _moveRight:withHistory:]):
(-[WKContentView _moveToStartOfWord:withHistory:]):
(-[WKContentView _moveToStartOfParagraph:withHistory:]):
(-[WKContentView _moveToStartOfLine:withHistory:]):
(-[WKContentView _moveToStartOfDocument:withHistory:]):
(-[WKContentView _moveToEndOfWord:withHistory:]):
(-[WKContentView _moveToEndOfParagraph:withHistory:]):
(-[WKContentView _moveToEndOfLine:withHistory:]):
(-[WKContentView _moveToEndOfDocument:withHistory:]):
(moveSelectionCommand):
(extendSelectionCommand):

Add helper methods to return a command (or list of commands) to execute, given `UITextGranularity`,
`UITextStorageDirection` and `UITextLayoutDirection`.

(-[WKContentView deleteInDirection:toGranularity:]):
(-[WKContentView moveInDirection:byGranularity:]):
(-[WKContentView moveInLayoutDirection:]):
(-[WKContentView extendInDirection:byGranularity:]):
(-[WKContentView extendInLayoutDirection:]):
(-[WKContentView executeEditCommandWithCallback:]): Deleted.

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




More information about the webkit-changes mailing list