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

  Changed paths:
    A 
LayoutTests/accessibility/isolated-tree/empty-final-line-range-expected.txt
    A LayoutTests/accessibility/isolated-tree/empty-final-line-range.html
    A 
LayoutTests/accessibility/mac/line-range-at-soft-break-excludes-space-expected.txt
    A LayoutTests/accessibility/mac/line-range-at-soft-break-excludes-space.html
    M Source/WebCore/accessibility/AXTextMarker.cpp

  Log Message:
  -----------
  AX: In isolated tree mode, AXStringForTextMarkerRange unexpectedly includes a 
whitespace at a soft line break
https://bugs.webkit.org/show_bug.cgi?id=322442
rdar://185725689

Reviewed by Dominic Mazzoni.

Layout drops the space a line soft-wraps at, but 
AccessibilityRenderObject::textRuns
re-adds it to the end of the wrapping line's run, so that a range spanning the 
wrap
still reads "foo bar" rather than "foobar". A line's range therefore ended one
character past the line's rendered text, and AXStringForTextMarkerRange over 
the range
AXTextMarkerRangeForLine returned included a space that renders on no line, 
e.g. for
<p style="width: 4ch">aaa bbb</p>, "aaa " rather than "aaa".

The live tree ends that range before the space. endOfLine() produces an upstream
position, and AXTextMarker::operator CharacterOffset() maps an upstream marker 
through
previousCharacterOffset().

With this commit, we do the same in the isolated tree by moving the returned
range's end marker back over the wrap space, which also brings its length and 
end
index in line with the live tree's (3, not 4).

* LayoutTests/accessibility/isolated-tree/empty-final-line-range-expected.txt: 
Added.
* LayoutTests/accessibility/isolated-tree/empty-final-line-range.html: Added.
* 
LayoutTests/accessibility/mac/line-range-at-soft-break-excludes-space-expected.txt:
 Added.
* LayoutTests/accessibility/mac/line-range-at-soft-break-excludes-space.html: 
Added.
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::lineRangeWithout):
(WebCore::AXTextMarker::characterRangeForLine const):
(WebCore::AXTextMarker::markerRangeForLineIndex const):
(WebCore::AXTextMarker::lineNumberForIndex const):
(WebCore::AXTextMarker::lineRange const):
(WebCore::lineRangeWithoutCollapsedTrailingNewline): Deleted.

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



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

Reply via email to