[webkit-changes] [WebKit/WebKit] bcf367: AX: Implement TextUnit::LeftWord/RightWord off the...

Joshua Hoffman noreply at github.com
Wed Oct 9 18:17:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bcf367428ee3db2103c809b74980932a50f902f2
      https://github.com/WebKit/WebKit/commit/bcf367428ee3db2103c809b74980932a50f902f2
  Author: Joshua Hoffman <jhoffman23 at apple.com>
  Date:   2024-10-09 (Wed, 09 Oct 2024)

  Changed paths:
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-word-nav-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-word-nav.html
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AXTextRun.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

  Log Message:
  -----------
  AX: Implement TextUnit::LeftWord/RightWord off the main thread
https://bugs.webkit.org/show_bug.cgi?id=280825
rdar://134579687

Reviewed by Tyler Wilcock.

This patch implements the `AXLeftWordTextMarkerRangeForTextMarker` and `AXRightWordTextMarkerRangeForTextMarker` attributes using the secondary thread text markers. To mimic the live tree’s current behavior, several edges cases had to be considered:
* If at the end of a paragraph (containing block), return without a word.
* If we are finding the left word, and we are at a start word boundary, that should return the whitespace prior to the word (if any).
* If we are finding the right word, and are at the end boundary of a word, return the whitespace to the right of the word.

To verify this new behavior, the test `text-marker-word-nav` was ported over from the live tree, with some modifications. APIs that still used the live tree were removed, due to some issues with interop between live and isolated tree text markers. Three test cases were are currently failing with FIXMEs: two due to the word break iterator with Chinese characters, and one due to line break behavior.

In order to accurately accommodate handling word navigation, I had to make a change to the `findMarker` method to allow for coalescing object boundaries. This is the cases where the end position of one object is equivalent visually/in position to the start position of the next object. Coalescing mimics behavior from the live tree.

* LayoutTests/accessibility/ax-thread-text-apis/text-marker-word-nav-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-word-nav.html: Added.
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::lineNumberForIndex const):
(WebCore::AXTextMarker::atLineBoundaryForDirection const):
(WebCore::AXTextMarker::offsetFromRoot const):
(WebCore::AXTextMarker::findLastBefore const):
(WebCore::AXTextMarker::findMarker const):
(WebCore::AXTextMarker::wordRange const):
(WebCore::AXTextMarker::equivalentTextPosition const):
(WebCore::AXTextMarker::partialOrderByTraversal const):
* Source/WebCore/accessibility/AXTextMarker.h:
(WebCore::AXTextMarker::nextWordStart const):
(WebCore::AXTextMarker::nextWordEnd const):
(WebCore::AXTextMarker::previousWordStart const):
(WebCore::AXTextMarker::previousWordEnd const):
* Source/WebCore/accessibility/AXTextRun.h:
(WebCore::AXTextRuns::toString const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeIsIgnored const):
(WebCore::AccessibilityRenderObject::textRuns):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper textMarkerRangeAtTextMarker:forUnit:]):

Canonical link: https://commits.webkit.org/284938@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