Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ca3a2787246df9e900fe011fb8b504299d6eb8e6
      
https://github.com/WebKit/WebKit/commit/ca3a2787246df9e900fe011fb8b504299d6eb8e6
  Author: Joshua Hoffman <[email protected]>
  Date:   2025-04-02 (Wed, 02 Apr 2025)

  Changed paths:
    A 
LayoutTests/accessibility/isolated-tree/soft-line-breaks-include-space-expected.txt
    A 
LayoutTests/accessibility/isolated-tree/soft-line-breaks-include-space.html
    M LayoutTests/accessibility/mac/line-range-at-soft-breaks-expected.txt
    M LayoutTests/accessibility/mac/line-range-at-soft-breaks.html
    M 
LayoutTests/accessibility/mac/line-requests-starting-after-first-line-expected.txt
    M LayoutTests/accessibility/mac/line-requests-starting-after-first-line.html
    A 
LayoutTests/accessibility/mac/text-marker-range-across-soft-break-includes-space-expected.txt
    A 
LayoutTests/accessibility/mac/text-marker-range-across-soft-break-includes-space.html
    M Source/WebCore/accessibility/AXTextRun.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp

  Log Message:
  -----------
  AX: [AX Thread Text APIs] Soft line breaks trim "space" from text runs
https://bugs.webkit.org/show_bug.cgi?id=290864
rdar://problem/148366358

Reviewed by Tyler Wilcock.

Prior to this point, AXTextRun(s) were not aware of trimmed spaces that occur 
when rendering soft line
breaks. This means that when text is rendered like the following (as a result 
of width constraints)

```
Hello
world
```

and we get a text marker range that spans across this line break, we would 
return a string of "Helloworld",
rather than "Hello world", which is what happens on the live tree.

To solve this problem, we re-add these trimmed characters when constructing the 
AXTextRuns, which is done
by looking for any gaps in the DOM offsets. By doing so, we now properly 
consider this character when
computing ranges, indices of text markers, and other APIs.

This change also creates new behavior. Now, the space character that isn't 
actually rendered is now exposed
to ATs. This means, as an example, users can navigate by character to it. This 
character won't have any
width, since it isn't rendered, but is included in the string and ranges we 
serve.

Two tests were added to verify this change. Additionally, two tests were 
updated to "trim" the new space
character we expose at the end of lines, so that the live and isolated trees 
can share the same test
expectations. Our new tests will provide the coverage gap that this creates.

* 
LayoutTests/accessibility/isolated-tree/soft-line-breaks-include-space-expected.txt:
 Added.
* LayoutTests/accessibility/isolated-tree/soft-line-breaks-include-space.html: 
Copied from LayoutTests/accessibility/mac/line-range-at-soft-breaks.html.
* LayoutTests/accessibility/mac/line-range-at-soft-breaks-expected.txt:
* LayoutTests/accessibility/mac/line-range-at-soft-breaks.html:
* 
LayoutTests/accessibility/mac/line-requests-starting-after-first-line-expected.txt:
* LayoutTests/accessibility/mac/line-requests-starting-after-first-line.html:
* 
LayoutTests/accessibility/mac/text-marker-range-across-soft-break-includes-space-expected.txt:
 Added.
* 
LayoutTests/accessibility/mac/text-marker-range-across-soft-break-includes-space.html:
 Added.
* Source/WebCore/accessibility/AXTextRun.cpp:
(WebCore::AXTextRuns::AXTextRuns):
* Source/WebCore/accessibility/AXTextRun.h:
(WebCore::AXTextRuns::AXTextRuns): Deleted.
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textRuns):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to