[webkit-changes] [WebKit/WebKit] 53c385: AX: WebKit fails to emit newlines between containe...

Tyler Wilcock noreply at github.com
Wed Feb 14 14:41:37 PST 2024


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

  Changed paths:
    M LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker.html
    M LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-unordered-markers.html
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-empty-paragraphs-expected.txt
    A LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-empty-paragraphs.html
    M LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range.html
    M LayoutTests/accessibility/ax-thread-text-apis/text-marker-with-user-select-none.html
    M Source/WebCore/accessibility/AXCoreObject.h
    M Source/WebCore/accessibility/AXLogger.cpp
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
    M Source/WebCore/accessibility/AccessibilityNodeObject.h
    M Source/WebCore/accessibility/AccessibilityObject.cpp
    M Source/WebCore/accessibility/AccessibilityObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
    M Source/WebCore/editing/TextIterator.cpp
    M Source/WebCore/editing/TextIterator.h

  Log Message:
  -----------
  AX: WebKit fails to emit newlines between container nodes when serving AXStringForTextMarkerRange off the main-thread
https://bugs.webkit.org/show_bug.cgi?id=269072
rdar://problem/122648346

Reviewed by Chris Fleizach.

Prior to this patch, AXTextMarker::findObjectWithRuns was basically just a wrapper over `findMatchingObjects`.
It has become clear that the traversal we need to do for text markers requires lots of custom hooks and behavior,
and it doesn't make sense to muddy `findMatchingObjects` for this single usecase, so this patch takes what we need
from `findMatchingObjects` and moves it directly into findObjectWithRuns.

This allows us to remove the `stopAtID` logic from `findMatchingObjects`. It also allows to add an "exit object"
hook to the traversal, which this patch uses to emit newlines when exiting a node that `shouldEmitNewlinesBeforeAndAfterNode`.
This matches the behavior of the TextIterator: dive into text-leaf nodes, and emit newlines for their containers on exit.

Prior to this patch, we never emitted any newline. Now we do, bringing us closer to passing several tests in
LayoutTests/accessibility/ax-thread-text-apis. This patch also documents in detail why several of these tests cotinue
to fail, and adds a new test that exercises interesting edgecases when we emit newlines for containers: text-marker-string-empty-paragraphs.html

* LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker.html:
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-range-with-unordered-markers.html:
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-empty-paragraphs-expected.txt: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-empty-paragraphs.html: Added.
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-string-for-document-range.html:
* LayoutTests/accessibility/ax-thread-text-apis/text-marker-with-user-select-none.html:
* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::appendChildren):
(WebCore::findObjectWithRuns):
(WebCore::AXTextMarkerRange::toString const):
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::shouldEmitNewlinesBeforeAndAfterNode const):
* Source/WebCore/accessibility/AccessibilityNodeObject.h:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::Accessibility::isAccessibilityObjectSearchMatchAtIndex):
(WebCore::Accessibility::findMatchingObjects):
* Source/WebCore/accessibility/AccessibilityObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeProperties):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::shouldEmitNewlinesBeforeAndAfterNode):
* Source/WebCore/editing/TextIterator.h:

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




More information about the webkit-changes mailing list