[webkit-changes] [WebKit/WebKit] c45853: AX: Implement support for serving AXLineForTextMar...

Tyler Wilcock noreply at github.com
Thu Feb 15 21:04:51 PST 2024


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

  Changed paths:
    A LayoutTests/accessibility/ax-thread-text-apis/line-index-for-textmarker-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/line-index-for-textmarker.html
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AXTextRun.cpp
    M Source/WebCore/accessibility/AXTextRun.h
    M Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: Implement support for serving AXLineForTextMarkerAttribute off the main-thread
https://bugs.webkit.org/show_bug.cgi?id=269411
rdar://problem/122977523

Reviewed by Chris Fleizach and Andres Gonzalez.

Beyond implementing support for this attribute, this patch also fixes several bugs
discovered while trying to make new test line-index-for-textmarker.html pass:

  - Calling nextLineEnd() or previousLineStart() on a text marker at the
    very end or start of a line would return the same TextMarker back,
    which is not what the API should do (it should return the start /
    end of the next / previous line).

  - AXTextMarker::findMarker(AXDirection, std::optional<AXID> stopAtID)
    failed to recursively propagate the stopAtID parameter when called
    on a non-text-leaf marker.

  - AXTextMarker::findMarker(AXDirection, std::optional<AXID>) failed to
    traverse the last run in a multi-run text-leaf because
    hasMoreTextInCurrentRun() compared the offset() to the length of the
    current run, which doesn't make sense (if the offset is pointing
    into the last run, it will always be greater than the length of that
    run because it includes the length of the text in preceding runs).
    This logic is now both more simple and more correct.

  - AXIsolatedObject::textMarkerRange() computed a range outside its
    descendants (not expected behavior for the API) when the object in
    question didn't have a sibling. Now we check for this, and pass a
    `stopAtID` of the parent to prevent this behavior.

* LayoutTests/accessibility/ax-thread-text-apis/line-index-for-textmarker-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/line-index-for-textmarker.html: Added.
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarkerRange::AXTextMarkerRange):
(WebCore::AXTextMarkerRange::intersectionWith const):
(WebCore::AXTextMarker::lineID const):
(WebCore::AXTextMarker::lineIndex const):
(WebCore::AXTextMarker::atLineBoundaryForDirection const):
(WebCore::AXTextMarker::findMarker const):
(WebCore::AXTextMarker::lineRange const):
* Source/WebCore/accessibility/AXTextMarker.h:
(WebCore::AXTextMarker::previousLineStart const):
(WebCore::AXTextMarker::nextLineEnd const):
(WebCore::AXTextMarker::atLineStart const):
(WebCore::AXTextMarker::atLineEnd const):
* Source/WebCore/accessibility/AXTextRun.cpp:
(WebCore::AXTextRuns::lineIDForOffset const):
* Source/WebCore/accessibility/AXTextRun.h:
(WebCore::AXTextRunLineID::operator bool const):
* Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
(WebCore::AXIsolatedObject::textMarkerRange const):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):

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




More information about the webkit-changes mailing list