Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 058338e8d64f6c036d5c619c0efe3eb4a2c2e0f4
      
https://github.com/WebKit/WebKit/commit/058338e8d64f6c036d5c619c0efe3eb4a2c2e0f4
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-05-13 (Wed, 13 May 2026)

  Changed paths:
    M Source/WebCore/accessibility/AXCoreObject.cpp

  Log Message:
  -----------
  AX: Reduce parent lookups in unignoredChildren pre-order traversal
https://bugs.webkit.org/show_bug.cgi?id=314691
rdar://176932652

Reviewed by Dominic Mazzoni.

Samples taken during AX queries showed nextSiblingIncludingIgnored
as ~95% of time in stitchedUnignoredChildren -> unignoredChildren ->
nextInPreOrder. Each call went through parentObject(), a virtual call
whose cost varies by subclass (HashMap lookup on AXIsolatedObject; DOM
traversal + axObjectCache lookup on AccessibilityRenderObject /
AccessibilityNodeObject) but is always non-trivial. The traversal was
paying for that lookup twice per ascended level. Two adjustments cut
the per-hop work:

1. nextInPreOrder: replace the pre-loop nextSiblingIncludingIgnored()
   call + in-loop parentObject() ascent with a single loop that fetches
   parent once per level. In the non-cross-frame case, the sibling-search
   parent and ascent parent are the same value, so the ascent reuses it
   via WTF::move, eliminating the duplicate parentObject() call and the
   accompanying RefPtr ref()/deref() per ascended level.

2. unignoredChildren: for ignored or invalid descendants, inline the
   descent step (matching nextInPreOrder's Column / TableHeaderContainer
   role guard via shouldSetChildIndexInParent()) instead of falling back
   to nextInPreOrder(). The function already had its own sibling-or-
   ascend loop that caches parent + siblings across sibling hops, but the
   nextInPreOrder() fallback was invalidating that cache every time the
   traversal crossed an ignored descendant. With the fallback gone,
   cached parent/siblings now survive through ignored-descendant
   traversal, and the per-hop cost drops to descendant->indexInParent() + a 
vector index.

* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::AXCoreObject::unignoredChildren):
(WebCore::AXCoreObject::nextInPreOrder):

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



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

Reply via email to