Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a276aa3fda7e8737df19898b289d8c9671ebd82
      
https://github.com/WebKit/WebKit/commit/4a276aa3fda7e8737df19898b289d8c9671ebd82
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-09-03 (Thu, 03 Sep 2026)

  Changed paths:
    A 
LayoutTests/accessibility/isolated-tree/offset-from-root-outside-text-run-expected.txt
    A 
LayoutTests/accessibility/isolated-tree/offset-from-root-outside-text-run.html
    M Source/WebCore/accessibility/AXTextMarker.cpp

  Log Message:
  -----------
  AX: In isolated tree mode, AXIndexForTextMarker returns 0 for a text marker 
in an empty text field at the end of the document
https://bugs.webkit.org/show_bug.cgi?id=323328
rdar://186571569

Reviewed by Dominic Mazzoni.

AXIndexForTextMarker on the accessibility thread is 
AXTextMarker::offsetFromRoot,
which begins by anchoring the marker to real text with toTextRunMarker(). That
function only ever searches forward, so a marker on an object with no text of 
its
own and no text after it *an empty text field that ends the document, for
example) has nothing to anchor to, and offsetFromRoot returned 0 rather than the
index of the position.

When forward anchoring finds nothing, anchor backwards instead, to the end of 
the
last run before the marker, as every character in the document precedes such a
position, so that run's end is its index.

Fixes accessibility/isolated-tree/offset-from-root-outside-text-run.html in 
isolated tree mode.

* 
LayoutTests/accessibility/isolated-tree/offset-from-root-outside-text-run-expected.txt:
 Added.
* 
LayoutTests/accessibility/isolated-tree/offset-from-root-outside-text-run.html: 
Added.
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::offsetFromRoot const):

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



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

Reply via email to