-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement UIAsyncTextInput methods to request word rects for and appl…
…y 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
- Loading branch information
Showing
3 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters