[webkit-changes] [WebKit/WebKit] 8e1031: Document markers sometimes get erroneously removed...

Richard Robinson noreply at github.com
Mon Feb 5 22:08:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e1031fc9a3ad0d3705c50866a49a019e7370363
      https://github.com/WebKit/WebKit/commit/8e1031fc9a3ad0d3705c50866a49a019e7370363
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
    A LayoutTests/editing/spelling/document-markers-remain-after-removing-text-expected.txt
    A LayoutTests/editing/spelling/document-markers-remain-after-removing-text.html
    M Source/WebCore/dom/DocumentMarkerController.cpp

  Log Message:
  -----------
  Document markers sometimes get erroneously removed on earlier words when removing text in a later part of the sentence
https://bugs.webkit.org/show_bug.cgi?id=268778
rdar://122336557

Reviewed by Megan Gardner and Aditya Keerthi.

When a text node (for example, "AAAA BBBB CCCC") has a document marker on it (for example, a spelling
marker on "AAAA"), and some text is then removed from it (like "CCCC"), the document marker will get
removed accidentally.

This is because the logic in `shiftMarkers` does not guard against markers that occur in the prior
part of the text, which should just be completely ignored and not removed or shifted, since they
would not be affected by the removal of later text.

Fix by checking for such a case and not removing the marker in that case.

* LayoutTests/editing/spelling/document-markers-remain-after-removing-text.html: Added.
* LayoutTests/platform/ios-simulator/editing/spelling/document-markers-remain-after-removing-text-expected.txt: Added.
* Source/WebCore/dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::shiftMarkers):

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




More information about the webkit-changes mailing list