[webkit-changes] [WebKit/WebKit] 188abd: AX: Convert between DOM offsets and rendered-text ...
Tyler Wilcock
noreply at github.com
Sat Feb 15 09:52:38 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 188abd709f1f171c33ff528582e4b24272764d90
https://github.com/WebKit/WebKit/commit/188abd709f1f171c33ff528582e4b24272764d90
Author: Tyler Wilcock <tyler_w at apple.com>
Date: 2025-02-15 (Sat, 15 Feb 2025)
Changed paths:
A LayoutTests/accessibility/select-whitespace-collapsed-text-expected.txt
A LayoutTests/accessibility/select-whitespace-collapsed-text.html
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/mac-wk1/TestExpectations
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
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/AccessibilityRenderObject.cpp
M Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Log Message:
-----------
AX: Convert between DOM offsets and rendered-text offsets in ENABLE(AX_THREAD_TEXT_APIS) to avoid crashes and incorrect behavior
https://bugs.webkit.org/show_bug.cgi?id=287707
rdar://144872799
Reviewed by Chris Fleizach.
With this commit, we implement the ability to convert between offsets into rendered text, which is every offset for
text markers created off the main-thread, and offsets into DOM text, which is pre-whitespace-collapse, and the offset
that is expected for main-thread position types like VisiblePosition.
Without this, any text marker created on the main-thread, e.g. from a VisiblePosition, could point out-of-bounds of
rendered text, causing a crash, or at least incorrect behavior.
* LayoutTests/accessibility/select-whitespace-collapsed-text-expected.txt: Added.
* LayoutTests/accessibility/select-whitespace-collapsed-text.html: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AXTextMarker.cpp:
(WebCore::TextMarkerData::TextMarkerData):
(WebCore::AXTextMarkerRange::AXTextMarkerRange):
(WebCore::AXTextMarkerRange::intersectionWith const):
(WebCore::partialOrder):
(WebCore::AXTextMarkerRange::isConfinedTo const):
(WebCore::AXTextMarkerRange::viewportRelativeFrame const):
(WebCore::AXTextMarkerRange::toString const):
* Source/WebCore/accessibility/AXTextMarker.h:
* Source/WebCore/accessibility/AXTextRun.cpp:
(WebCore::AXTextRuns::substring const):
(WebCore::AXTextRuns::domOffset const):
* Source/WebCore/accessibility/AXTextRun.h:
(WebCore::AXTextRun::AXTextRun):
(WebCore::AXTextRun::domOffsets const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textRuns):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
Canonical link: https://commits.webkit.org/290443@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