[webkit-changes] [WebKit/WebKit] 309970: Implement UIAsyncTextInput methods to request word...
Wenson Hsieh
noreply at github.com
Fri Oct 20 14:16:38 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 309970939cb08c60f9ed724eddd2410e2053b55f
https://github.com/WebKit/WebKit/commit/309970939cb08c60f9ed724eddd2410e2053b55f
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-10-20 (Fri, 20 Oct 2023)
Changed paths:
M Source/WTF/wtf/PlatformHave.h
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Log Message:
-----------
Implement UIAsyncTextInput methods to request word rects for and apply autocorrections
https://bugs.webkit.org/show_bug.cgi?id=263388
rdar://117219847
Reviewed by Tim Horton and Abrar Rahman Protyasha.
Adopt several new `UIAsyncTextInput` (and adjacent) methods and classes:
```
UIKeyEventContext
-requestTextRectsForString:withCompletionHandler:
-replaceText:withText:options:withCompletionHandler:
-deferEventHandlingToSystemWithContext:
```
See below for more details.
* Source/WTF/wtf/PlatformHave.h:
Add a compile-time flag to guard the availability of these new APIs.
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
Import some of these new private headers.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(+[WKUITextSelectionRect selectionRectWithCGRect:]):
(-[WKUITextSelectionRect initWithCGRect:]):
(-[WKUITextSelectionRect rect]):
Add a custom `UITextSelectionRect` subclass that we can initialize with a `CGRect`.
(-[WKContentView _ensureBinaryCompatibilityWithAsyncInteractionsIfNeeded]):
To make debugging and bincompat sanity-checking a bit more convenient, dump all optional methods on
`UIAsyncTextInput` that are unimplemented on the content view.
(-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
(-[WKContentView _internalRequestTextRectsForString:completion:]):
Refactor these two legacy `UIWKInteractionViewProtocol` methods to use the same internal helper
method as the new `UIAsyncTextInput` methods. Note that these internal helper methods don't use any
of the legacy `UIWK*` classes; this will make it easier to cleanly excise these deprecated codepaths
after the minimum supported iOS version has system support for `UIAsyncTextInput`.
(-[WKContentView applyAutocorrection:toString:isCandidate:withCompletionHandler:]):
(-[WKContentView _internalReplaceText:withText:isCandidate:completion:]):
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
Set up a key event context object when deferring key event handling to the system; this allows
only `keypress` events to trigger text editing, while still allowing `keydown` events to trigger
other actions, like menu commands.
(-[WKContentView replaceText:withText:options:withCompletionHandler:]):
(-[WKContentView requestTextRectsForString:withCompletionHandler:]):
Canonical link: https://commits.webkit.org/269593@main
More information about the webkit-changes
mailing list