[webkit-changes] [WebKit/WebKit] 9d4124: AX: Reduce main-thread hits for descriptionAttribu...

Tyler Wilcock noreply at github.com
Tue Mar 14 11:14:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d4124105e23ff66e9d6d520ed9e87e472abec8f
      https://github.com/WebKit/WebKit/commit/9d4124105e23ff66e9d6d520ed9e87e472abec8f
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-03-14 (Tue, 14 Mar 2023)

  Changed paths:
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/AccessibilityObjectInterface.h
    M Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm
    M Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: Reduce main-thread hits for descriptionAttributeValue, titleAttributeValue, and accessibilityHitTest
https://bugs.webkit.org/show_bug.cgi?id=253796
rdar://problem/106619115

Reviewed by Chris Fleizach.

For AccessibilityRole::StaticText objects, descriptionAttributeValue and titleAttributeValue always return
an empty string. We know an object's role value before going to the main-thread, so this patch uses this
information to prevent main-thread hits for static text objects.

Based on a sample from a popular social media site, descriptionAttributeValue occupied 17133 of 95949 total samples,
while titleAttributeValue occupied 3836 of 95949 samples. Static text made up ~5.5% of the descriptionAttributeValue
requests and ~4.6% of the titleAttributeValue requests, meaning this patch saves ~1150 samples across both of them.
The savings will be higher for sites with greater amounts of static text.

This patch also fixes a bug in which -[WebAccessibilityObjectWrapperMac accessibilityHitTest] goes to the main-thread
to hit test the widget backing an object without checking if AXCoreObject::isWidget first, meaning this main-thread hit
is wasted for non-widgets. This saves 479 samples.

* Source/WebCore/accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isMediaControlLabel const): Deleted.
* Source/WebCore/accessibility/AccessibilityObjectInterface.h:
(WebCore::AXCoreObject::shouldComputeDescriptionAttributeValue const):
(WebCore::AXCoreObject::shouldComputeTitleAttributeValue const):
(WebCore::Accessibility::performFunctionOnMainThreadAsync):
* Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:
(WebCore::AccessibilityObject::descriptionAttributeValue const):
(WebCore::AccessibilityObject::titleAttributeValue const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::scrollToMakeVisible const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::descriptionAttributeValue const):
(WebCore::AXIsolatedObject::titleAttributeValue const):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityHitTest:]):

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




More information about the webkit-changes mailing list