[webkit-changes] [WebKit/WebKit] 7eb5b4: AX: AXIsolatedTree::collectNodeChangesForSubtree w...

Tyler Wilcock noreply at github.com
Tue Sep 26 19:42:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7eb5b4bd73cecf533d4d8c65030307ff53f7e30d
      https://github.com/WebKit/WebKit/commit/7eb5b4bd73cecf533d4d8c65030307ff53f7e30d
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-09-26 (Tue, 26 Sep 2023)

  Changed paths:
    M LayoutTests/accessibility/title-ui-element-correctness-expected.txt
    M LayoutTests/accessibility/title-ui-element-correctness.html
    M LayoutTests/platform/glib/accessibility/title-ui-element-correctness-expected.txt
    M Source/WebCore/accessibility/AXLogger.cpp
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h

  Log Message:
  -----------
  AX: AXIsolatedTree::collectNodeChangesForSubtree wastefully collects node changes for objects already in the isolated tree
https://bugs.webkit.org/show_bug.cgi?id=261937
rdar://problem/115879218

Reviewed by Andres Gonzalez.

AXIsolatedTree::updateChildren uses collectNodeChangesForSubtree to keep the isolated tree
up-to-date. Prior to this patch, collectNodeChangesForSubtree unconditionally added every node it
walked to m_unresolvedPendingAppends. This results in tons of unnecessary work re-building objects
that are already in the isolated tree.

With this patch, collectNodeChangesForSubtree now only queues node changes for objects that are not
yet in the isolated tree. Our previous coarseness in updates papered over several cache invalidation
bugs, a few of which are fixed with this patch and others in previous patches. In this patch, we fix:

  * AXPropertyName::CanSetFocusAttribute not being updated when tabindex changes
  * AXPropertyName::TitleUIElement not being updated when the for attribute of a label
    changes from one control to another
  * AXPropertyName::TitleUIElement not being updated when a control's label is removed

This change requires us to do a bit more bookkeeping in the form of a new member variable: AXIsolatedTree::m_protectedFromDeletionIDs.
This protects re-parented nodes from being removed. Prior to this patch, we would allow this
removal to happen, but then create a whole new node change for it, papering over this issue.

This patch also adds AXIsolatedTree::m_parentUpdates and AXIsolatedTree::m_pendingParentUpdates.
These allow object's m_parentID to be updated when it diverges from the live tree. Again, we were
protected against this before by way of making entire new node changes with the most up-to-date parent.

Before this patch, using VoiceOver on an academic journal webpage resulted in an average of
127880 node changes created. After this change, an average of 24412 node changes were created (4 runs each).

* LayoutTests/accessibility/title-ui-element-correctness-expected.txt:
* LayoutTests/accessibility/title-ui-element-correctness.html:
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleRoleChanged):
(WebCore::AXObjectCache::handleAttributeChange):
(WebCore::AXObjectCache::labelForAttributeChanged):
(WebCore::AXObjectCache::updateIsolatedTree):
(WebCore::AXObjectCache::relationAttributes):
(WebCore::AXObjectCache::labelChanged): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::queueRemovalsLocked):
(WebCore::AXIsolatedTree::queueAppendsAndRemovals):
(WebCore::AXIsolatedTree::collectNodeChangesForSubtree):
(WebCore::AXIsolatedTree::updateNodeProperties):
(WebCore::AXIsolatedTree::removeNode):
(WebCore::AXIsolatedTree::removeSubtreeFromNodeMap):
(WebCore::AXIsolatedTree::applyPendingChanges):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:

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




More information about the webkit-changes mailing list