[webkit-changes] [WebKit/WebKit] d910e3: AX: Move attributedStringForNSRange off the main t...

AndresGonzalezApple noreply at github.com
Fri Apr 21 17:29:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d910e37f80bbdedb7958583b5af88d528e652b78
      https://github.com/WebKit/WebKit/commit/d910e37f80bbdedb7958583b5af88d528e652b78
  Author: Andres Gonzalez <andresg_22 at apple.com>
  Date:   2023-04-21 (Fri, 21 Apr 2023)

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

  Log Message:
  -----------
  AX: Move attributedStringForNSRange off the main thread when possible.
https://bugs.webkit.org/show_bug.cgi?id=255789
<rdar://problem/108369924>

Reviewed by Chris Fleizach.

This patch avoids hitting the main thread for requests of the AttributedString for NSRanges contained in a text control. That is the most common case during text editing. To accomplish this, textMarkerRangeForNSRange needs to build a TextMarkerRange based on CharacterOffsets and not in VisiblePositions. In addition, the ranges used in caching the TextContent and the AttributedString also need to be based on CharacterOffsets.

* Source/WebCore/accessibility/AXTextMarker.h:
(WebCore::AXTextMarkerRange::operator bool const): Clean up.
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::textContent const):
* Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:
(WebCore::AccessibilityObject::textMarkerRangeForNSRange const):
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::initializePlatformProperties):
(WebCore::AXIsolatedObject::textMarkerRangeForNSRange const):
(WebCore::AXIsolatedObject::attributedStringForTextMarkerRange const):
(WebCore::AXIsolatedObject::cachedAttributedStringForTextMarkerRange const): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper attributedStringForNSRange:]):
(-[WebAccessibilityObjectWrapper rtfForNSRange:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
(-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]): Renamed.
(-[WebAccessibilityObjectWrapper doAXRTFForRange:]): Renamed.

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




More information about the webkit-changes mailing list