[webkit-changes] [WebKit/WebKit] 329677: AX: AXIsolatedTree::createEmptyContent takes too l...

AndresGonzalezApple noreply at github.com
Tue Oct 24 05:49:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 329677707e9488c112f38b66eb9f94ced7a3d607
      https://github.com/WebKit/WebKit/commit/329677707e9488c112f38b66eb9f94ced7a3d607
  Author: Andres Gonzalez <andresg_22 at apple.com>
  Date:   2023-10-24 (Tue, 24 Oct 2023)

  Changed paths:
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h

  Log Message:
  -----------
  AX: AXIsolatedTree::createEmptyContent takes too long.
https://bugs.webkit.org/show_bug.cgi?id=263403
<rdar://problem/117224271>

Reviewed by Chris Fleizach and Tyler Wilcock.

The first cause of this method being slow is the calculation of the DocumentLinks property for the WebArea. That causes a traversal of the entire DOM tree. This property should return an empty array in the case of the empty content tree, so the calculation is unnecessary any way. Not performing this calculation for the empty content tree WebArea reduces the execution time of the mehtod to ~1/10 of the original time.

In addition, this patch re-writes AXIsolatedTree::createEmptyContent to perform the minimum possible operations in creating the isolated objects for the ScrollView and WebARea, and adding them to the corresponding data structures. In particular, this r-write avoids calling children() on the WebArea live object that can result in the traversal of many levels of the DOM and Render trees.

* Source/WebCore/accessibility/AXCoreObject.h:
(WebCore::Accessibility::findChild):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeProperties):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::createEmptyContent):
(WebCore::AXIsolatedTree::collectNodeChangesForChildrenMatching): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::isEmptyContentTree const):
(WebCore::AXIsolatedTree::isCollectingNodeChanges const):

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




More information about the webkit-changes mailing list