[webkit-changes] [WebKit/WebKit] 42d447: [iOS] -replaceText:withText:options:completionHand...

Wenson Hsieh noreply at github.com
Thu Feb 29 10:21:33 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 42d447047f4f9d4930ec81b6ddf02077ba4ca993
      https://github.com/WebKit/WebKit/commit/42d447047f4f9d4930ec81b6ddf02077ba4ca993
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm

  Log Message:
  -----------
  [iOS] -replaceText:withText:options:completionHandler: does not work for multiple words
https://bugs.webkit.org/show_bug.cgi?id=270285
rdar://121351577

Reviewed by Richard Robinson.

Adjust this codepath to replace the original text in the cases where:
1. The original text is in front of (or around) the selection.
2. The original text spans multiple words.

To achieve this, we also refactor and simplify the fallback codepath that searches for the original
text before the caret selection, such that we try to discover the original text before or after the
selection, using `rangeExpandedAroundPositionByCharacters` and `findPlainText`.

Test: AutocorrectionTests.MultiWordAutocorrectionFromStartOfText

* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::applyAutocorrectionInternal):
* Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list