[webkit-changes] [WebKit/WebKit] 043e71: [iOS] Prepare API tests for async text input enabl...

Wenson Hsieh noreply at github.com
Mon Dec 18 11:56:39 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 043e71bfb0158320e9539bfb750d7e74bd9f5d7b
      https://github.com/WebKit/WebKit/commit/043e71bfb0158320e9539bfb750d7e74bd9f5d7b
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-12-18 (Mon, 18 Dec 2023)

  Changed paths:
    R Source/WebKit/UIProcess/API/ios/WKSEDefinitions.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    A Source/WebKit/UIProcess/ios/WKSEDefinitions.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestRunnerShared/spi/UIKitSPIForTesting.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm
    M Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm
    M Tools/TestWebKitAPI/Tests/ios/EnterKeyHintTests.mm
    M Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
    M Tools/TestWebKitAPI/Tests/ios/SelectionModifyByParagraphBoundary.mm
    M Tools/TestWebKitAPI/Tests/ios/TextServicesTests.mm
    M Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
    M Tools/WebKitTestRunner/Configurations/Base.xcconfig
    M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
    M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

  Log Message:
  -----------
  [iOS] Prepare API tests for async text input enablement
https://bugs.webkit.org/show_bug.cgi?id=266578
rdar://119816733

Reviewed by Aditya Keerthi.

Prepare our API tests for async text input enablement on iOS, many of which currently call into
legacy SPI methods that crash with the feature flag enabled. To avoid these release assertions, we
refactor all tests which explicitly call into these codepaths, such that they'll invoke their
`UIAsyncTextInput` counterparts when `UIKit/async_text_input` is enabled.

See below for more details.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView moveInDirection:byGranularity:]):
(-[WKContentView extendInDirection:byGranularity:]):

Also drive-by fix an actual bug that was caught by `SelectionTests.ModifyByParagraphBoundary`.
Instead of just moving backward or forward by paragraph granularity in the `UIAsyncTextInput` method
`-extendInDirection:byGranularity:`, we need to additionally move backwards or forwards by character
before doing so in order to maintain parity with `-_moveToEndOfParagraph:withHistory:` and
`_moveToStartOfParagraph:withHistory:`.

* Source/WebKit/UIProcess/ios/WKSEDefinitions.h: Renamed from Source/WebKit/UIProcess/API/ios/WKSEDefinitions.h.

Also move `WKSEDefinitions.h` to `UIProcess/ios` instead of `UIProcess/API/ios`, since the latter
just holds iOS-specific files related to WebKit API objects (in this case, only `WKWebView`).
Putting this in `UIProcess/ios` seems more appropriate, and also allows us to include it directly in
WebKitTestRunner.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestRunnerShared/spi/UIKitSPIForTesting.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
(-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm:
(TestWebKitAPI::simulateEditContextMenuAppearance):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewEditingActions.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TestWebKitAPI::simulateEditContextMenuAppearance):
* Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
(-[TestWKWebView autocorrectionRectsForString:]): Deleted.
(-[TestWKWebView synchronouslyRequestAutocorrectionContext]): Deleted.
* Tools/TestWebKitAPI/Tests/ios/EnterKeyHintTests.mm:
(-[TestWKWebView test:enterKeyHint:returnKeyType:]):
* Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
* Tools/TestWebKitAPI/Tests/ios/SelectionModifyByParagraphBoundary.mm:
* Tools/TestWebKitAPI/Tests/ios/TextServicesTests.mm:
* Tools/TestWebKitAPI/Tests/ios/WKScrollViewTests.mm:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:

Add a bunch of new category helpers on `WKWebView`, which replace many of the direct calls into
`WKContentView` in our API tests when exercising various `UIWKInteractionViewProtocol` SPIs. These
helper methods will call directly into these legacy SPIs when async text input is disabled, but will
call into their new `UIAsyncTextInput` counterparts when async text input is enabled.

(-[WKWebView defineSelection]):
(-[WKWebView shareSelection]):
(-[WKWebView hasAsyncTextInput]):
(-[WKWebView selectionClipRect]):
(-[WKWebView moveSelectionToStartOfParagraph]):
(-[WKWebView extendSelectionToStartOfParagraph]):
(-[WKWebView moveSelectionToEndOfParagraph]):
(-[WKWebView extendSelectionToEndOfParagraph]):
(-[WKWebView asyncTextInput]):
(-[WKWebView extendedTextInputTraits]):
(-[WKWebView autocorrectionRectsForString:]):
(-[WKWebView autocorrectionContext]):
(-[WKWebView effectiveTextInputTraits]):
(-[WKWebView replaceText:withText:shouldUnderline:completion:]):
(wrap):
(unwrap):
(-[WKWebView synchronouslyAdjustSelectionWithDelta:]):
(-[WKWebView selectTextForContextMenuWithLocationInView:completion:]):
(-[WKWebView handleKeyEvent:completion:]):
* Tools/WebKitTestRunner/Configurations/Base.xcconfig:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::asyncTextInput const):

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




More information about the webkit-changes mailing list