Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b5639a26a2d81b24b253095bfaba536f2255987e
https://github.com/WebKit/WebKit/commit/b5639a26a2d81b24b253095bfaba536f2255987e
Author: Tyler Wilcock <[email protected]>
Date: 2026-05-28 (Thu, 28 May 2026)
Changed paths:
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
Log Message:
-----------
AX: AXObjectCache::updateCurrentModalNode() is O(N * m_modalElements) per
modalNode() call, causing hangs on pages with many large modals
https://bugs.webkit.org/show_bug.cgi?id=315797
rdar://167441819
Reviewed by Dominic Mazzoni.
modalNode() is required to compute ignoredFromModalPresence(), which is
part of computeIsIgnored(), a very hot function. Prior to this commit,
when there are m_modalElements but none are active (e.g., because they
don't have accessible content or don't contain focus), we would walk
every single descendant of every modal, resulting in O(m_modalElements *
num_descendants)
work.
With this commit, we take advantage of the fact that in order for a
modal to be active, it must have focus within, and now only walk the
descendants of a modal in search of accessible content when it actually
has focus within it.
We also don't bother searching for accessible content inside inert
subtrees inside the modal -- we know none of this will be accessible and
don't need to walk it.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::isNodeAccessible):
(WebCore::AXObjectCache::modalElementHasAccessibleContent):
(WebCore::AXObjectCache::updateCurrentModalNode):
(WebCore::AXObjectCache::modalNode):
(WebCore::AXObjectCache::isNodeVisible const): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
Canonical link: https://commits.webkit.org/314114@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications