Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b2177e4ae385e3c4d991a2dc4a61ba96bd783e8e
      
https://github.com/WebKit/WebKit/commit/b2177e4ae385e3c4d991a2dc4a61ba96bd783e8e
  Author: Dominic Mazzoni <[email protected]>
  Date:   2026-08-27 (Thu, 27 Aug 2026)

  Changed paths:
    A 
LayoutTests/accessibility/isolated-tree/mac/replace-range-at-block-boundary-expected.txt
    A 
LayoutTests/accessibility/isolated-tree/mac/replace-range-at-block-boundary.html
    A LayoutTests/accessibility/mac/replace-range-at-block-boundary-expected.txt
    A LayoutTests/accessibility/mac/replace-range-at-block-boundary.html
    M Source/WebCore/accessibility/AccessibilityObject.cpp

  Log Message:
  -----------
  AX: AXReplaceRangeWithText inserts text at the wrong index
rdar://186004521

Reviewed by Tyler Wilcock.

AccessibilityObject::replaceTextInRange resolved the character range
through rangeForCharacterRange, which walks CharacterOffsets. A
CharacterOffset names a node and a side of it, so at a block boundary
a single character index belongs to two of them: the position after
the <br> that ends the preceding block, and the position starting the
next block. The walk picked the former. That is not a caret position
-- a <br> ending a block is collapsed out by rendering and has nothing
after it -- so it canonicalized back over the <br>, one character
early. Resolving the same index through visiblePositionForIndex lands
on the position that renders where the caller means, so
replaceTextInRange now uses that.

Tests: accessibility/isolated-tree/mac/replace-range-at-block-boundary.html
       accessibility/mac/replace-range-at-block-boundary.html

* 
LayoutTests/accessibility/isolated-tree/mac/replace-range-at-block-boundary-expected.txt:
 Added.
* 
LayoutTests/accessibility/isolated-tree/mac/replace-range-at-block-boundary.html:
 Added.
* LayoutTests/accessibility/mac/replace-range-at-block-boundary-expected.txt: 
Added.
* LayoutTests/accessibility/mac/replace-range-at-block-boundary.html: Added.
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::replaceTextInRange):

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



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

Reply via email to