[webkit-changes] [WebKit/WebKit] cc3d1e: AX: Compute AXAttributedStringForTextMarkerRangeAt...

Tyler Wilcock noreply at github.com
Mon Dec 2 16:32:50 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cc3d1eef8dbf47a550477853ab61012aa91192e9
      https://github.com/WebKit/WebKit/commit/cc3d1eef8dbf47a550477853ab61012aa91192e9
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2024-12-02 (Mon, 02 Dec 2024)

  Changed paths:
    A LayoutTests/accessibility/ax-thread-text-apis/attributed-string/attributed-string-text-styling-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/attributed-string/attributed-string-text-styling.html
    A LayoutTests/accessibility/ax-thread-text-apis/attributed-string/dynamic-style-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/attributed-string/dynamic-style.html
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/accessibility/AXCoreObject.cpp
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/AXLogger.cpp
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AccessibilityObject.h
    A Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm
    M Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm
    M Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
    M Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm
    M Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
    M Source/WebCore/rendering/RenderText.cpp
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  AX: Compute AXAttributedStringForTextMarkerRangeAttribute off the main-thread for ranges pointing to static text objects
https://bugs.webkit.org/show_bug.cgi?id=283607
rdar://problem/140447302

Reviewed by Chris Fleizach.

This commit implements off-main-thread support for AXAttributedStringForTextMarkerRangeAttribute for text marker ranges
that point within a single static text object. Supporting ranges that span multiple objects, and ranges that are confined
to one object that is not static text, will be implemented in future patches. These both should be much easier with this
base laid down, as fundamentally they will need to simply move from static text to static text, using the code written
in this commit to build a combined attributed string.

Beyond setting style attributes on attributed strings, there are several other categories of attributes that this commit
leaves for a future patch, e.g. heading level, blockquote level, expanded text, and a few more.

Several new isolated tree properties were added to support this functionality. Once this work is complete and ships, several
existing stale cache bugs will be fixed (we do not currently update cached attributed strings when style changes).

With this commit, we now pass attributed-string/attributed-string-text-styling.html with AX_THREAD_TEXT_APIS_ENABLED.
A new test is also created to ensure that dynamic style changes are reflected in an object's computed attributed string:
ax-thread-text-apis/attributed-string/dynamic-style.html

* LayoutTests/accessibility/ax-thread-text-apis/attributed-string/attributed-string-text-styling-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/attributed-string/attributed-string-text-styling.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/attributed-string/dynamic-style-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/attributed-string/dynamic-style.html: Added.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::LineDecorationStyle::LineDecorationStyle):
(WebCore::LineDecorationStyle::debugDescription const):
* Source/WebCore/accessibility/AXCoreObject.h:
(WebCore::LineDecorationStyle::LineDecorationStyle):
(WebCore::AttributedStringStyle::hasUnderline const):
(WebCore::AttributedStringStyle::underlineColor const):
(WebCore::AttributedStringStyle::hasLinethrough const):
(WebCore::AttributedStringStyle::linethroughColor const):
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::onStyleChange):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::characterRangeForLine const):
(WebCore::AXTextMarker::lineNumberForIndex const):
* Source/WebCore/accessibility/AXTextMarker.h:
* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm: Added.
(WebCore::attributedStringContainsRange):
(WebCore::attributedStringSetFont):
(WebCore::attributedStringSetColor):
(WebCore::attributedStringSetStyle):
(WebCore::AXCoreObject::createAttributedString const):
* Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm:
(WebCore::AXTextMarkerRange::toAttributedString const):
* Source/WebCore/accessibility/cocoa/AccessibilityObjectCocoa.mm:
(WebCore::fontFrom):
(WebCore::textColorFrom):
(WebCore::backgroundColorFrom):
(WebCore::AccessibilityObject::font const):
(WebCore::AccessibilityObject::textColor const):
(WebCore::AccessibilityObject::backgroundColor const):
(WebCore::AccessibilityObject::isSubscript const):
(WebCore::AccessibilityObject::isSuperscript const):
(WebCore::AccessibilityObject::hasTextShadow const):
(WebCore::AccessibilityObject::lineDecorationStyle const):
(WebCore::AccessibilityObject::stylesForAttributedString const):
(WebCore::attributedStringContainsRange): Deleted.
(WebCore::attributedStringSetFont): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeProperties):
(WebCore::AXIsolatedObject::setProperty):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeProperties):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::updateNodeProperty):
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::initializePlatformProperties):
(WebCore::AXIsolatedObject::stylesForAttributedString const):
(WebCore::AXIsolatedObject::textMarkerRange const):
* Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::attributedStringSetColor): Deleted.
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
* Source/WebCore/rendering/RenderText.cpp:
(WebCore::RenderText::styleDidChange):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveComposedTree):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list