[webkit-changes] [WebKit/WebKit] d39e84: AX: De-duplicate node changes
Joshua Hoffman
noreply at github.com
Mon Dec 11 17:49:03 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d39e84f7bea75d5494ef9929e78d32b93f1ddb72
https://github.com/WebKit/WebKit/commit/d39e84f7bea75d5494ef9929e78d32b93f1ddb72
Author: Joshua Hoffman <jhoffman23 at apple.com>
Date: 2023-12-11 (Mon, 11 Dec 2023)
Changed paths:
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
M Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
Log Message:
-----------
AX: De-duplicate node changes
https://bugs.webkit.org/show_bug.cgi?id=265702
rdar://problem/119052949
Reviewed by Andres Gonzalez.
By nature of deferring some node changes while handling others eagerly, we end up doing duplicate work.
For example, we may queue up both a property change and a node change for the same node, which results
in unnecessary work.
To resolve this, this patch creates a new route for all queued node changes to go through,
AXIsolatedTree::queueNodeUpdate, and a new place to process those queued changes,
AXIsolatedTree::processQueuedNodeUpdates. Inside this mechanism, we queue up three types
of node changes (in three sets/arrays):
(1) Node changes
(2) Children changes
(3) Property changes
When we are queuing nodes, we add property updates only for nodes that aren't already queued for a
node change. When processing queued updates, for children and property changes, we prevent duplicates
by checking if a node is already present in m_unresolvedPendingAppends.
We process these queued changes in two cases:
(1) After a timer that fires 100ms after a node change has been queued up.
(2) Before we post a platform notification.
This patch does *not* include the work to defer updateChildren. That work will come in a follow up patch.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::~AXObjectCache):
(WebCore::AXObjectCache::updateIsolatedTree):
(WebCore::AXObjectCache::updateIsolatedTree const):
(WebCore::AXObjectCache::startUpdateTreeSnapshotTimer):
(WebCore::AXObjectCache::updateTreeSnapshotTimerFired):
(WebCore::AXObjectCache::processQueuedIsolatedNodeUpdates):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updatePropertiesForSelfAndDescendants):
(WebCore::AXIsolatedTree::updateNodeProperties):
(WebCore::AXIsolatedTree::updateNodeAndDependentProperties):
(WebCore::AXIsolatedTree::labelCreated):
(WebCore::AXIsolatedTree::queueNodeUpdate):
(WebCore::AXIsolatedTree::processQueuedNodeUpdates):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::NodeUpdateOptions::NodeUpdateOptions):
(WebCore::NodeUpdateOptions::nodeUpdate):
(WebCore::NodeUpdateOptions::childrenUpdate):
* Source/WebCore/accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
(WebCore::AXObjectCache::postPlatformAnnouncementNotification):
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotificationForTextControl):
Canonical link: https://commits.webkit.org/271907@main
More information about the webkit-changes
mailing list