-
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.
Cherry-pick a01be23. rdar://problem/113604696
Cherry-pick 6517574. rdar://problem/113036177 [iOS] Tap to revert does not always display an accurate prompt for multi-word autocorrections https://bugs.webkit.org/show_bug.cgi?id=259595 rdar://113036177 Reviewed by Wenson Hsieh. UIKit requires additional information in order to detect that a tapped word is part of a multi-word correction. Specifically, they require the entire corrected string given a single tapped word, in order to look up the right autocorrection record. To support this requirement, add support for obtaining autocorrected ranges in a document editing context. WebKit will provide `autocorrectedRanges` on `UIWKDocumentContext`, when the `UIWKDocumentRequest` has `UIWKDocumentRequestAutocorrectedRanges` specified in its flags. Then, with the existing properties on `UIWKDocumentContext`, UIKit can determine the corrected string nearest to the current selection. * Source/WebCore/dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::forEach): Pass the node into the callback function so that it may be used to obtain a `SimpleRange` from the `DocumentMarker`. (WebCore::DocumentMarkerController::rangesForMarkersInRange): Return a `SimpleRange` for each `DocumentMarker`. (WebCore::DocumentMarkerController::hasMarkers): (WebCore::DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange): * Source/WebCore/dom/DocumentMarkerController.h: * Source/WebKit/Platform/spi/ios/UIKitSPI.h: * Source/WebKit/Shared/DocumentEditingContext.h: * Source/WebKit/Shared/DocumentEditingContext.mm: (WebKit::DocumentEditingContext::toPlatformContext): (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::encode): (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode): * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (toWebDocumentRequestOptions): * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: Resolve the `SimpleRange` from each marker as a character range, using a `SimpleRange` representing the current context. Populate `context.autocorrectedRanges` to be sent back to the UI process and UIKit. (WebKit::WebPage::requestDocumentEditingContext): * Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm: (TEST): * Tools/TestWebKitAPI/ios/UIKitSPI.h: Canonical link: https://commits.webkit.org/266398@main Identifier: 265870.279@safari-7616-branch
- Loading branch information
Showing
9 changed files
with
140 additions
and
7 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
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
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