[webkit-changes] [WebKit/WebKit] 6429c9: AX: Implement off-main-thread AXTextMarker::partia...

Tyler Wilcock noreply at github.com
Wed Feb 7 13:13:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6429c99998c87d1da2cafe85c6ce9078aad2554a
      https://github.com/WebKit/WebKit/commit/6429c99998c87d1da2cafe85c6ce9078aad2554a
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    A LayoutTests/accessibility/ax-thread-text-apis/character-offset-visible-position-conversion-hang-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/character-offset-visible-position-conversion-hang.html
    M LayoutTests/accessibility/ax-thread-text-apis/content-editable-attributed-string-expected.txt
    M LayoutTests/accessibility/ax-thread-text-apis/content-editable-attributed-string.html
    A LayoutTests/accessibility/ax-thread-text-apis/crash-in-element-for-text-marker-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/crash-in-element-for-text-marker.html
    A LayoutTests/accessibility/ax-thread-text-apis/crash-invalid-text-marker-node-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/crash-invalid-text-marker-node.html
    A LayoutTests/accessibility/ax-thread-text-apis/index-for-zero-offset-text-marker-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/index-for-zero-offset-text-marker.html
    A LayoutTests/accessibility/ax-thread-text-apis/line-range-for-text-marker-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/line-range-for-text-marker.html
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-stale-node-crash-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-stale-node-crash.html
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-removed-node-crash-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-removed-node-crash.html
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range.html
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/AXLogger.cpp
    M Source/WebCore/accessibility/AXLogger.h
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AccessibilityObject.cpp
    M Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm

  Log Message:
  -----------
  AX: Implement off-main-thread AXTextMarker::partialOrder and AXCoreObject::textMarkerRange
https://bugs.webkit.org/show_bug.cgi?id=268672
rdar://problem/122212250

Reviewed by Chris Fleizach.

We can implement AXTextMarker::partialOrder by traversing the AX tree, and returning less or greater depending on
where we find the other marker in relation to the one we started with. AXCoreObject::textMarkerRange was already
sometimes able to be served off the main-thread, except for objects that don't have textContent() of their own.
With this patch, we use cached text runs to implement off-main-thread AXCoreObject::textMarkerRange in this case too.

This patch also ports several new tests to ax-thread-text-apis/ to increase our test coverage of this feature.

* LayoutTests/accessibility/ax-thread-text-apis/content-editable-attributed-string-expected.txt:
* LayoutTests/accessibility/ax-thread-text-apis/content-editable-attributed-string.html:
Remove attributedStringForTextMarkerRange calls. We haven't implemented this yet, and for some inexplicable
reason avoiding a main-thread hit in AXTextMarker::partialOrder causes some subsequent attributed string
requests to reutrn nil. Work around this for now until we can actually implement this API.

* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/AXLogger.cpp:
* Source/WebCore/accessibility/AXLogger.h:
(WebCore::streamTextRuns):
(WebCore::streamAXCoreObject):
Add the ability to dump the text runs associated with an object.

* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::partialOrder):
(WebCore::findObjectWithRuns):
(WebCore::AXTextMarker::findLast const):
(WebCore::AXTextMarker::findMarker const):
(WebCore::AXTextMarker::toTextLeafMarker const):
(WebCore::AXTextMarker::partialOrderByTraversal const): Added.
* Source/WebCore/accessibility/AXTextMarker.h:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::Accessibility::findMatchingObjects):
Add the ability to stop the search when encountering the specified AXID.

* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::textMarkerRange const):

* LayoutTests/accessibility/ax-thread-text-apis/character-offset-visible-position-conversion-hang-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/character-offset-visible-position-conversion-hang.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/crash-in-element-for-text-marker-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/crash-in-element-for-text-marker.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/crash-invalid-text-marker-node-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/crash-invalid-text-marker-node.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/line-range-for-text-marker-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/line-range-for-text-marker.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-stale-node-crash-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-stale-node-crash.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-removed-node-crash-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-removed-node-crash.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range.html: Added.

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




More information about the webkit-changes mailing list