[webkit-changes] [WebKit/WebKit] 8dfd5f: [Writing Tools] Reverting a proofreading session m...

Aditya Keerthi noreply at github.com
Mon Oct 7 12:00:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8dfd5f755284bb2823e064842a90bfef185d406e
      https://github.com/WebKit/WebKit/commit/8dfd5f755284bb2823e064842a90bfef185d406e
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-10-07 (Mon, 07 Oct 2024)

  Changed paths:
    M Source/WebCore/dom/DocumentMarkerController.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Reverting a proofreading session may not restore the original text
https://bugs.webkit.org/show_bug.cgi?id=280955
rdar://137233726

Reviewed by Richard Robinson.

Reverting a proofreading session is performed by iterating document markers in
reverse order and restoring the original text specified in the marker data.

However, when adding a marker for a suggestion with multiple words, more than
one marker may get added, as `DocumentMarkerController` adds one marker per
text range. These text ranges are determined using
`DocumentMarkerController::collectTextRanges`.

For most marker types, markers for adjacent text ranges are merged. However,
since `shouldInsertAsSeparateMarker` returns true for proofreading markers,
the extra markers are not merged. Finally, this results in an issue when
performing a revert, since additional text will be restored, due to the presence
of additional markers.

Fix by allowing proofreading markers to be merged if their IDs are the same.

* Source/WebCore/dom/DocumentMarkerController.cpp:
(WebCore::shouldInsertAsSeparateMarker):
(WebCore::canMergeMarkers):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, ProofreadingRevertWithMultiwordSuggestions)):

Canonical link: https://commits.webkit.org/284775@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