Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1d20b393299846d0309ebc7240db4a680b18b46b
https://github.com/WebKit/WebKit/commit/1d20b393299846d0309ebc7240db4a680b18b46b
Author: Dominic Mazzoni <[email protected]>
Date: 2026-07-17 (Fri, 17 Jul 2026)
Changed paths:
A
LayoutTests/accessibility/mac/line-index-marker-in-large-block-expected.txt
A LayoutTests/accessibility/mac/line-index-marker-in-large-block.html
M Source/WebCore/accessibility/AXTextMarker.cpp
Log Message:
-----------
AX: Make AXTextMarker::lineIndex() O(1) when start and target share a
containing block
rdar://182338926
https://bugs.webkit.org/show_bug.cgi?id=319522
Reviewed by Tyler Wilcock and Andres Gonzalez.
lineIndex() computed a marker's line number by walking the tree line-by-line
from
the start of the document (or editable/text-control root) to the target line, so
it is O(lines-from-start) per call. VoiceOver requests AXLineForTextMarker on
every
caret movement, so on a page that is a single large block wrapping onto
thousands
of lines (e.g. a long flat list of links) character navigation degrades to
O(n^2).
When the start marker and the target marker share a containing block, both line
IDs come from that block's own monotonic line numbering, so the line count
between
them is just the difference of their line indices — no walk needed. Inline
replaced
elements store their own renderer in the lineID's containing-block slot, so they
don't match here and correctly fall through to the existing walk.
Adds line-index-marker-in-large-block.html: pure-text (no replaced elements) so
the
result is unambiguous and identical on the live and isolated trees, verifying
lineIndex() is correct for markers deep inside a single block.
* LayoutTests/accessibility/mac/line-index-marker-in-large-block-expected.txt:
Added.
* LayoutTests/accessibility/mac/line-index-marker-in-large-block.html: Added.
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::lineIndex const):
Canonical link: https://commits.webkit.org/317438@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications