-
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.
[iOS] Tap to revert does not work for multi-word autocorrections
https://bugs.webkit.org/show_bug.cgi?id=259522 rdar://112908387 Reviewed by Wenson Hsieh. There are two issues preventing multi-word autocorrection UI from working correctly: 1. The correction indicator is only applied to the last word. 2. `-[WKContentView selectWordForReplacement]` does not extend the selection to cover multiple autocorrected words. To fix (1), apply the correction indicator marker to the entire autocorrected range. This is achieved by searching backwords for the inserted text to obtain a range. Then (2) is fixed by leveraging the same logic to extend the selection for dictation alternatives, by extending the selection to cover the entire DocumentMarker::CorrectionIndicator. * Source/WebCore/editing/TextIterator.h: * Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::adjustCandidateAutocorrectionInFrame): Search for the autocorrected range, beginning at the start of the editable content and ending at the current selection. Search backwards since we know the range will be at the end. Mark the entire range with `DocumentMarker::CorrectionIndicator`. (WebKit::WebPage::extendSelectionForReplacement): Extend the selection to encompass the entire `DocumentMarker::CorrectionIndicator`. (WebKit::WebPage::applyAutocorrectionInternal): * Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm: (TEST): Canonical link: https://commits.webkit.org/266336@main
- Loading branch information
Showing
3 changed files
with
58 additions
and
10 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