[webkit-changes] [WebKit/WebKit] 27dbd3: [iOS] Update WKSETextInput/WKSETextInteraction ado...
Wenson Hsieh
noreply at github.com
Tue Jan 16 13:42:48 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 27dbd349074d620e5080dafbc5d80ee760de25f6
https://github.com/WebKit/WebKit/commit/27dbd349074d620e5080dafbc5d80ee760de25f6
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-01-16 (Tue, 16 Jan 2024)
Changed paths:
M Source/WTF/wtf/PlatformHave.h
M Source/WebCore/platform/ios/WebEvent.mm
M Source/WebCore/platform/ios/WebEventPrivate.h
M Source/WebCore/platform/ios/WebSEDefinitions.h
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Source/WebKit/Shared/DocumentEditingContext.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h
M Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm
M Source/WebKit/UIProcess/ios/WKSEDefinitions.h
M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h
M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm
M Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm
M Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm
M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Log Message:
-----------
[iOS] Update WKSETextInput/WKSETextInteraction adoption
https://bugs.webkit.org/show_bug.cgi?id=267555
rdar://121011826
Reviewed by Tim Horton.
Since 272018 at main landed, there have been numerous minor adjustments to the async text input API in
ServiceExtensions; now that the API shape is finally stable, we adjust the WebKit preadoption to use
these new method and symbol names when `SERVICE_EXTENSIONS_TEXT_INPUT_IS_AVAILABLE` is set, while
ensuring binary compatibility with the old UIKit async text input symbols.
See below for more details.
* Source/WebCore/platform/ios/WebEvent.mm:
(webEventType):
(isChangingKeyModifiers):
(-[WebEvent initWithKeyEntry:]):
(-[WebEvent originalKeyEntry]):
(-[WebEvent initWithKeyEvent:]): Deleted.
(-[WebEvent originalKeyEvent]): Deleted.
Rename `WebSEKeyEvent` to `WebSEKeyEntry`, and `WebSEKeyEventType` to `WebSEKeyPressState`.
* Source/WebCore/platform/ios/WebEventPrivate.h:
* Source/WebCore/platform/ios/WebSEDefinitions.h:
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
Remove `HAVE_UI_ASYNC_TEXT_INTERACTION_DELEGATE`, since it's been in SDKs where
`HAVE_UI_ASYNC_TEXT_INTERACTION` is set for months now.
* Source/WebKit/Shared/DocumentEditingContext.mm:
Import the relevant system headers.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
Rename numerous text input delegate method implementations, to fit the new API shape.
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
Also address the fact that calls to `-hasSelectablePositionAtPoint:` have been replaced with calls
to `-textInteractionGesture:shouldBeginAtPoint:` with `WKSEGestureTypeForceTouch`, since the former
was only used in a few places for the purposes of handling force touch.
(-[WKContentView replaceForWebView:]):
(-[WKContentView selectionBarColor]):
Replace `-selectionBarColor` with `-selectionHandleColor`.
(-[WKContentView canPerformAction:withSender:]):
Replace `-moveInDirection:byGranularity:` with `-moveInStorageDirection:byGranularity:`.
(toGestureType):
(toWKSEGestureType):
(toSelectionTouch):
(toWKSESelectionTouchPhase):
(selectionChangedWithTouch):
(-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
(logTextInteraction):
(-[WKContentView _internalBeginSelectionChange]):
(-[WKContentView _internalEndSelectionChange]):
(-[WKContentView addTextAlternatives:]):
(-[WKContentView _updateTextInputTraits:]):
(shiftKeyState):
(-[WKContentView modifierFlagsDidChangeFrom:to:]):
(-[WKContentView _deferKeyEventToInputMethodEditing:]):
(-[WKContentView _interpretKeyEvent:isCharEvent:]):
(-[WKContentView _transpose]):
(-[WKContentView _updateInputContextAfterBlurringAndRefocusingElement]):
(-[WKContentView _selectionChanged]):
(-[WKContentView _provideSuggestionsToInputDelegate:]):
(-[WKContentView _provideUITextSuggestionsToInputDelegate:]):
(toWebDocumentRequestOptions):
(toWebRequest):
(-[WKContentView requestDocumentContext:completionHandler:]):
(-[WKContentView asWKSETextInput]):
The following method implementations represent the set of final API names, which wrap calls to
`UIAsyncTextInput` methods.
(-[WKContentView systemWillPresentEditMenuWithAnimator:]):
(-[WKContentView systemWillDismissEditMenuWithAnimator:]):
(-[WKContentView insertTextAlternatives:]):
(-[WKContentView insertText:textAlternatives:style:]):
Note: `-insertText:textAlternatives:style:` was renamed to `-insertTextAlternatives:` here, but we
implement both versions of this new delegate method for now to ensure binary compatibility with
both versions of ServiceExtensions.
(-[WKContentView isPointNearMarkedText:]):
(-[WKContentView replaceSelectedText:withText:]):
(-[WKContentView updateCurrentSelectionTo:fromGesture:inState:]):
(-[WKContentView setSelectionFromPoint:toPoint:gesture:state:]):
(-[WKContentView adjustSelectionBoundaryToPoint:touchPhase:baseIsStart:flags:]):
(-[WKContentView moveSelectionAtBoundary:inStorageDirection:completionHandler:]):
(-[WKContentView extendedTextInputTraits]):
(-[WKContentView selectTextForEditMenuWithLocationInView:completionHandler:]):
(-[WKContentView isSelectionAtDocumentStart]):
(-[WKContentView automaticallyPresentEditMenu]):
(-[WKContentView asyncSystemInputDelegate]):
(-[WKContentView setAsyncInputDelegate:setAsyncSystemInputDelegate:]):
(-[WKContentView handleKeyEntry:withCompletionHandler:handleAsyncKeyEvent:withCompletionHandler:]):
(-[WKContentView replaceText:withText:options:completionHandler:replaceText:withText:options:withCompletionHandler:]):
(-[WKContentView moveInStorageDirection:byGranularity:moveInDirection:byGranularity:]):
(-[WKContentView extendInStorageDirection:byGranularity:extendInDirection:byGranularity:]):
(-[WKContentView adjustSelectionByRange:completionHandler:adjustSelection:completionHandler:]):
(-[WKContentView transposeCharacters]):
(-[WKContentView shiftKeyStateChangedFromState:toState:shiftKeyStateChangedFrom:to:]):
(-[WKContentView systemWillChangeSelectionForInteraction:selectionWillChange:]):
(-[WKContentView systemDidChangeSelectionForInteraction:selectionDidChange:]):
(-[WKContentView _showDictionary:]): Deleted.
Remove this altogether, since it's now just dead code with recent versions of UIKit.
(toWKSESelectionTouch): Deleted.
(-[WKContentView setAsyncSystemInputDelegate:]): Deleted.
(-[WKContentView handleAsyncKeyEvent:withCompletionHandler:]): Deleted.
(-[WKContentView replaceText:withText:options:withCompletionHandler:]): Deleted.
(-[WKContentView moveInDirection:byGranularity:]): Deleted.
(-[WKContentView extendInDirection:byGranularity:]): Deleted.
(-[WKContentView adjustSelection:completionHandler:]): Deleted.
(-[WKContentView shiftKeyStateChangedFrom:to:]): Deleted.
(-[WKContentView selectionWillChange:]): Deleted.
(-[WKContentView selectionDidChange:]): Deleted.
* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.h:
* Source/WebKit/UIProcess/ios/WKExtendedTextInputTraits.mm:
(-[WKExtendedTextInputTraits setSelectionHandleColor:]):
(-[WKExtendedTextInputTraits selectionHandleColor]):
(-[WKExtendedTextInputTraits setSelectionBarColor:]):
(-[WKExtendedTextInputTraits selectionBarColor]):
(-[WKExtendedTextInputTraits setSelectionColorsToMatchTintColor:]):
* Source/WebKit/UIProcess/ios/WKSEDefinitions.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper initWithView:]):
(-[WKTextInteractionWrapper selectionChanged]):
(-[WKTextInteractionWrapper selectionChangedWithGestureAt:withGesture:withState:withFlags:]):
(-[WKTextInteractionWrapper selectionChangedWithTouchAt:withSelectionTouch:withFlags:]):
(-[WKTextInteractionWrapper lookup:withRange:fromRect:]):
(-[WKTextInteractionWrapper showShareSheetFor:fromRect:]):
(-[WKTextInteractionWrapper showTextServiceFor:fromRect:]):
(-[WKTextInteractionWrapper scheduleReplacementsForText:]):
(-[WKTextInteractionWrapper scheduleChineseTransliterationForText:]):
(-[WKTextInteractionWrapper translate:fromRect:]):
(-[WKTextInteractionWrapper showDictionaryFor:fromRect:]): Deleted.
* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
* Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
(TEST):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView moveSelectionToStartOfParagraph]):
(-[WKWebView extendSelectionToStartOfParagraph]):
(-[WKWebView moveSelectionToEndOfParagraph]):
(-[WKWebView extendSelectionToEndOfParagraph]):
(-[WKWebView extendedTextInputTraits]):
(-[WKWebView autocorrectionContext]):
(-[WKWebView replaceText:withText:shouldUnderline:completion:]):
(wrap):
(unwrap):
Update `TestWKWebView` API testing helpers to use the new API shape when
`SERVICE_EXTENSIONS_TEXT_INPUT_IS_AVAILABLE` is set.
(-[WKWebView synchronouslyAdjustSelectionWithDelta:]):
(-[WKWebView selectTextForContextMenuWithLocationInView:completion:]):
(-[WKWebView handleKeyEvent:completion:]):
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::applyAutocorrection):
Canonical link: https://commits.webkit.org/273093@main
More information about the webkit-changes
mailing list