[webkit-changes] [WebKit/WebKit] f238a7: AX: -[WebAccessibilityObjectWrapperMac attachmentV...

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


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

  Changed paths:
    M Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: -[WebAccessibilityObjectWrapperMac attachmentView] should only be called when needed
https://bugs.webkit.org/show_bug.cgi?id=253752
rdar://problem/106584475

Reviewed by Chris Fleizach.

There are several places where we repeat calls to `-[WebAccessibilityObjectWrapperMac attachmentView]` in close succession
rather than storing the attachment view in a local variable and re-using it. This is wasteful in ITM as each call
requires a separate, synchronous round-trip to the main-thread.

Most notably of all, this patch fixes a bug where we didn't check `AXCoreObject::isAttachment()` before calling
`-[WebAccessibilityObjectWrapperMac attachmentView]` when handling `AXUIElementForTextMarkerAttribute`. This bug
effectively meant that we went to the main-thread for 100% of objects to try to get their attachmentView, even for
objects that are not attachments (which is the majority). In a sample taken from a popular social media website,
this bug caused 3828 samples of 95949 total secondary thread samples.

* Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::attributedStringSetElement):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(makeNSArray):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
(-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):

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




More information about the webkit-changes mailing list