Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 07681dd80dbd6d21b57377dd7169116ac89adff9
      
https://github.com/WebKit/WebKit/commit/07681dd80dbd6d21b57377dd7169116ac89adff9
  Author: Tyler Wilcock <[email protected]>
  Date:   2025-01-07 (Tue, 07 Jan 2025)

  Changed paths:
    M Source/WebCore/accessibility/AXTextMarker.cpp
    M Source/WebCore/accessibility/AXTextMarker.h
    M Source/WebCore/accessibility/AccessibilityRenderObject.cpp

  Log Message:
  -----------
  AX: In ENABLE(AX_THREAD_TEXT_APIS), we fail to include trailing newlines in 
the returned range for the AXRangeForLine attribute
https://bugs.webkit.org/show_bug.cgi?id=285460
rdar://142433642

Reviewed by Chris Fleizach.

In `AccessibilityRenderObject::doAXRangeForLine`, we extend the returned range 
by one if the last character is a newline:

https://github.com/WebKit/WebKit/blob/1538792f6d0149ec77015a26a1a5485ad406f2de/Source/WebCore/accessibility/AccessibilityRenderObject.cpp#L1883#L1884

We need to match this behavior in `ENABLE(AX_THREAD_TEXT_APIS)` mode. We 
normally don't do this (which is arguably the more
intuitive behavior). So to facilitate this, this commit splits 
`findMarker(AXDirection, AXTextUnit, AXTextUnitBoundary, std::optional<AXID> 
stopAtID)`
into sub-fuctions `findWord`, `findSentence`, `findLine`, and `findParagraph`, 
rather than handling them all in what was
`findMarker`. This means we only have to pass a new `IncludeTrailingLineBreak` 
flag to `findLine`. This also is a little more
clean, as `findMarker` used to unconditionally do work that was only used for 
one `AXTextUnit`.

* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::AXTextMarker::characterRangeForLine const):
(WebCore::AXTextMarker::findMarker const):
(WebCore::AXTextMarker::findLine const):
(WebCore::AXTextMarker::findParagraph const):
(WebCore::AXTextMarker::findWordOrSentence const):
(WebCore::AXTextMarker::previousParagraphStart const):
(WebCore::AXTextMarker::toTextRunMarker const):
(WebCore::AXTextMarker::isInTextRun const):
(WebCore::AXTextMarker::lineRange const):
(WebCore::AXTextMarker::sentenceRange const):
* Source/WebCore/accessibility/AXTextMarker.h:
(WebCore::AXTextMarker::findWord const):
(WebCore::AXTextMarker::findSentence const):
(WebCore::AXTextMarker::findLine const):
(WebCore::AXTextMarker::previousLineStart const):
(WebCore::AXTextMarker::nextLineEnd const):
(WebCore::AXTextMarker::nextWordStart const):
(WebCore::AXTextMarker::nextWordEnd const):
(WebCore::AXTextMarker::previousWordStart const):
(WebCore::AXTextMarker::previousWordEnd const):
(WebCore::AXTextMarker::previousSentenceStart const):
(WebCore::AXTextMarker::nextSentenceEnd const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::doAXRangeForLine const):

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