Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d7c42ec32b31f263bccc11a2625e30d60ea54c29
      
https://github.com/WebKit/WebKit/commit/d7c42ec32b31f263bccc11a2625e30d60ea54c29
  Author: Megan Gardner <[email protected]>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    M Source/WebCore/page/writing-tools/WritingToolsController.h
    M Source/WebCore/page/writing-tools/WritingToolsController.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm

  Log Message:
  -----------
  [Writing Tools] Hovering over the different options for AOP causes both 
suggestions to get inserted.
https://bugs.webkit.org/show_bug.cgi?id=317253
rdar://175304947

Reviewed by Abrar Rahman Protyasha.

On sites whose rich-text editor maintains its own document model and reconciles 
the DOM after every WebKit-driven
mutation (Lexical on Reddit, ProseMirror, Slate, CKEditor 5), suggestion marker 
offsets cached in
WritingToolsController go stale across state-update events, and subsequent 
Pending/Accepted writes land at the wrong
location. Validate the marker's current target text against the expected text 
on each update; if the offsets have
drifted, re-anchor by searching the session range for the expected text and 
picking the closest match. Bail out
cleanly if it can't be found rather than writing into a stale range. Also 
remove suggestion markers by suggestion ID
across the whole session range instead of by cached node + offset, since the 
cached node can itself be stale after a
reconcile.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm

* Source/WebCore/page/writing-tools/WritingToolsController.h:
* Source/WebCore/page/writing-tools/WritingToolsController.mm:
(WebCore::WritingToolsController::proofreadingSessionDidUpdateStateForSuggestion):
(WebCore::WritingToolsController::validatedRangeForSuggestionMarker const):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm:
(TEST(WritingTools, ProofreadingReviewDoesNotWriteIntoDriftedMarker)):

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



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

Reply via email to