[webkit-changes] [WebKit/WebKit] 513928: [UIAsyncTextInput] Adopt `-[UIAsyncTextInteraction...
Wenson Hsieh
noreply at github.com
Fri Nov 10 12:38:56 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 513928cfe121683ce95b1928b4407bf49c8b7365
https://github.com/WebKit/WebKit/commit/513928cfe121683ce95b1928b4407bf49c8b7365
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-11-10 (Fri, 10 Nov 2023)
Changed paths:
M Source/WTF/wtf/PlatformHave.h
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm
Log Message:
-----------
[UIAsyncTextInput] Adopt `-[UIAsyncTextInteractionDelegate selection(Will|Did)Change:]`
https://bugs.webkit.org/show_bug.cgi?id=264589
Reviewed by Megan Gardner.
Adopt two `UIAsyncTextInteractionDelegate` methods:
```
-[UIAsyncTextInteractionDelegate selectionWillChange:]
-[UIAsyncTextInteractionDelegate selectionDidChange:]
```
...in place of these two methods currently on `UITextInputAdditions`:
```
-[UITextInputAdditions beginSelectionChange]
-[UITextInputAdditions endSelectionChange]
```
These method hooks allow `WKContentView` to implement some bookkeeping when UIKit is driving
selection changes (e.g. during text interactions, such as tapping to change an editable caret
selection). Note that while clients of the latter currently need to call `-selectionWillChange:` and
`-selectionDidChange:`, the new API does not require this (and instead calls these methods from
underneath the async text input).
* Source/WTF/wtf/PlatformHave.h:
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
Add a new compile-time flag to guard the availability of `UIAsyncTextInteractionDelegate`.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
Conform to `UIAsyncTextInteractionDelegate` when possible.
(-[WKContentView moveByOffset:]):
(-[WKContentView accessoryView:tabInDirection:]):
(-[WKContentView beginSelectionChange]):
(-[WKContentView _internalBeginSelectionChange]):
We invoke `-(begin|end)SelectionChange` in various places, from within WebKit code; to avoid our own
release assertions, split this out into `_internal`-prefixed methods, for use within the engine.
(-[WKContentView _updateInternalStateBeforeSelectionChange]):
(-[WKContentView endSelectionChange]):
Add assertions as well to enforce that the system doesn't call into these internal hooks when the
input delegate is a `UIAsyncTextInput`.
(-[WKContentView _internalEndSelectionChange]):
(-[WKContentView _updateInternalStateAfterSelectionChange]):
(-[WKContentView executeEditCommandWithCallback:]):
(-[WKContentView _selectionChanged]):
(-[WKContentView selectWordForReplacement]):
(-[WKContentView selectionWillChange:]):
(-[WKContentView selectionDidChange:]):
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper initWithView:]):
Canonical link: https://commits.webkit.org/270563@main
More information about the webkit-changes
mailing list