Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: da7ff45293cafd8b692e5d13e84fd02927a87f07
      
https://github.com/WebKit/WebKit/commit/da7ff45293cafd8b692e5d13e84fd02927a87f07
  Author: Andres Gonzalez <[email protected]>
  Date:   2025-12-16 (Tue, 16 Dec 2025)

  Changed paths:
    M 
LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt
    M 
LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html
    M 
LayoutTests/accessibility/mac/character-offset-from-upstream-position-expected.txt
    M LayoutTests/accessibility/mac/character-offset-from-upstream-position.html
    M 
LayoutTests/accessibility/mac/content-editable-attributed-string-expected.txt
    M LayoutTests/accessibility/mac/content-editable-attributed-string.html
    M LayoutTests/accessibility/mac/line-range-for-text-marker.html
    M 
LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt
    M LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html
    M Source/WebCore/accessibility/AccessibilityObject.cpp

  Log Message:
  -----------
  AX: The line range for a given VisiblePosition should include the line break 
if one exists at the end of the line.
https://bugs.webkit.org/show_bug.cgi?id=304225
rdar://148920198

Reviewed by Tyler Wilcock.

Both VisibleUnits endOfLine, AccessibilityObject::nextLineEndPosition, and the 
heuristics added to AccessibilityObject::lineRangeForPosition exclude a 
trailing line break ('\n' or equivalent) from the computed line range. This 
causes that VoiceOver does not properly display empty lines in Braille, as 
reported in rdar://148920198.

This patch fixes this problem by replacing the existing heuristics with a 
straightforward algorithm consisting in moving from the given visible position 
until either the new position is no longer in the same line or a line break is 
found, and includes the line break position in the returned range. This change 
applies only to AccessibilityObjects and not to AXIsolatedObjects.

Several tests listed below had to be modified to account for this behavior 
change. In some cases, it was necessary to trim the string returned by 
stringForTextMarkerRange in order for the test to pass in both ITM on and off 
modes. The differences in behavior between ITM on and off needs to be addressed 
in future patches.

Covered by existing tests.
* 
LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines-expected.txt:
* 
LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html:
* 
LayoutTests/accessibility/mac/character-offset-from-upstream-position-expected.txt:
* LayoutTests/accessibility/mac/character-offset-from-upstream-position.html:
* LayoutTests/accessibility/mac/content-editable-attributed-string-expected.txt:
* LayoutTests/accessibility/mac/content-editable-attributed-string.html:
* LayoutTests/accessibility/mac/line-range-for-text-marker.html:
* 
LayoutTests/accessibility/mac/search-predicate-from-ignored-element-expected.txt:
* LayoutTests/accessibility/mac/search-predicate-from-ignored-element.html:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::lineRangeForPosition const):

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



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

Reply via email to