[webkit-changes] [WebKit/WebKit] 250d33: [iOS] Add support for simulating UITextChecker res...
Wenson Hsieh
noreply at github.com
Fri Jul 7 16:45:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 250d336cc274116333d50d07264f76062116f1ad
https://github.com/WebKit/WebKit/commit/250d336cc274116333d50d07264f76062116f1ad
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-07-07 (Fri, 07 Jul 2023)
Changed paths:
M Source/WebKit/Platform/spi/ios/UIKitSPI.h
M Tools/DumpRenderTree/ios/UIScriptControllerIOS.h
M Tools/TestRunnerShared/cocoa/LayoutTestSpellChecker.h
M Tools/TestRunnerShared/cocoa/LayoutTestSpellChecker.mm
M Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h
M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
M Tools/WebKitTestRunner/mac/TestControllerMac.mm
M Tools/WebKitTestRunner/mac/UIScriptControllerMac.h
M Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm
Log Message:
-----------
[iOS] Add support for simulating UITextChecker results in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=258990
rdar://111404885
Reviewed by Tim Horton.
Add some test infrastructure that I'll be adopting as a part of a new layout test in a subsequent
patch. This refactors `UIScriptController::setSpellCheckerResults` (which is currently only
implemented on macOS) such that it is usable on iOS as well. See below for more details.
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Tools/DumpRenderTree/ios/UIScriptControllerIOS.h:
* Tools/TestRunnerShared/cocoa/LayoutTestSpellChecker.h:
* Tools/TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
Compile this on iOS as well, by subclassing `UITextChecker` instead of `NSSpellChecker`. Most of
the logic remains the same, but with a handful of minor differences.
(ensureGlobalLayoutTestSpellChecker):
(nsTextCheckingType):
(+[LayoutTestSpellChecker checker]):
(+[LayoutTestSpellChecker uninstallAndReset]):
(-[LayoutTestSpellChecker setResultsFromJSValue:inContext:]):
(stringForCorrectionResponse):
(swizzledGrammarDetailsForString):
(-[LayoutTestSpellChecker grammarAlternativesForString:]):
Implement this and intercept calls into `TextComposer` to grab grammar checking details over the
scope of this function call; this allows us to ensure that tapping on grammar checking ranges (blue
underlines on iOS) shows an edit menu with the appropriate text replacements.
(-[LayoutTestSpellChecker checkString:range:types:languages:options:]):
(-[LayoutTestSpellChecker _doneLoading]):
* Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):
Move the call to `+[LayoutTestSpellChecker reset]` out of `TestControllerMac`, and into
`TestControllerCocoa` where it runs on both macOS and iOS.
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::setSpellCheckerResults):
Move this logic out of `UIScriptControllerMac`, and into `UIScriptControllerCocoa` instead where it
can service both macOS and iOS testing.
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* Tools/WebKitTestRunner/mac/UIScriptControllerMac.h:
* Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptControllerMac::setSpellCheckerResults): Deleted.
Canonical link: https://commits.webkit.org/265869@main
More information about the webkit-changes
mailing list