[webkit-changes] [WebKit/WebKit] 2517a5: AX: Several classes never reset m_subtreeDirty to ...

Tyler Wilcock noreply at github.com
Sat Jul 8 00:23:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2517a540e6f5a2037c6843102f3a9cb753f2f9f0
      https://github.com/WebKit/WebKit/commit/2517a540e6f5a2037c6843102f3a9cb753f2f9f0
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h
    M Source/WebCore/accessibility/AccessibilityListBox.cpp
    M Source/WebCore/accessibility/AccessibilityMenuList.cpp
    M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
    M Source/WebCore/accessibility/AccessibilityScrollView.cpp
    M Source/WebCore/accessibility/AccessibilitySlider.cpp
    M Source/WebCore/accessibility/AccessibilityTable.cpp
    M Source/WebCore/accessibility/AccessibilityTableRow.cpp

  Log Message:
  -----------
  AX: Several classes never reset m_subtreeDirty to false
https://bugs.webkit.org/show_bug.cgi?id=258998
rdar://problem/111929312

Reviewed by Chris Fleizach.

This patch fixes issues in many classes where m_subtreeDirty was either
never reset back to false (i.e. in AccessibilityTable), or sometimes not
reset back to false depending on early returns. Because isolated tree
updates rely on this flag to know what to update, the fact it was never
reset was causing extreme amounts of work.

This patch also features another performance improvement for isolated
tree mode when handling children-changed updates. Prior to this patch,
we would call AXIsolatedTree::updateChildren as part of
AXObjectCache::handleChildrenChanged. This was bad because it resulted
in thrashing of m_subtreeDirty, specifically:

  1. AXObjectCache::handleChildrenChanged would set m_subtreeDirty = true on
     some high-in-the-tree object (which in turn is passed down to its
     whole subtree)
  2. AXIsolatedTree::updateChildren would run, performing updates as
     necessary and clearing m_subtreeDirty (setting it false)
  3. We would process the next entry, which would reset m_subtreeDirty
     on many of the same elements we just processed, causing
     AXIsolatedTree::updateChildren to repeat a lot of work.

With this patch, m_deferredChildrenChangedList is processed in two phases.
First, we iterate through the list calling AXObjectCache::handleChildrenChanged,
marking objects as dirty. Then, we iterate again and update the isolated tree via
AXIsolatedTree::updateChildren.

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAllDeferredChildrenChanged):
(WebCore::AXObjectCache::handleChildrenChanged):
(WebCore::AXObjectCache::performDeferredCacheUpdate):
* Source/WebCore/accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::handleAllDeferredChildrenChanged):
* Source/WebCore/accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::addChildren):
* Source/WebCore/accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::addChildren):
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::addChildren):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::addChildren):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::clearChildren):
* Source/WebCore/accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::addChildren):
* Source/WebCore/accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::addChildren):
* Source/WebCore/accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::addChildren):

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




More information about the webkit-changes mailing list