Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 631a9678ee656600d2e8353511cbbac17786b37b
https://github.com/WebKit/WebKit/commit/631a9678ee656600d2e8353511cbbac17786b37b
Author: Tyler Wilcock <[email protected]>
Date: 2025-04-08 (Tue, 08 Apr 2025)
Changed paths:
A LayoutTests/accessibility/mac/attributed-string-with-image-expected.txt
A LayoutTests/accessibility/mac/attributed-string-with-image.html
A LayoutTests/accessibility/mac/replaced-element-text-selection-expected.txt
A LayoutTests/accessibility/mac/replaced-element-text-selection.html
M LayoutTests/platform/mac-wk1/TestExpectations
M Source/WebCore/accessibility/AXCoreObject.cpp
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
M Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm
M Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm
M Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
Log Message:
-----------
AX: WebKit fails to construct text marker ranges that include replaced
elements, and never includes AXAttachment in attributed strings, causing
various VoiceOver usage issues
https://bugs.webkit.org/show_bug.cgi?id=291267
rdar://148834405
Reviewed by Joshua Hoffman.
This commit fixes several bugs introduced by ENABLE(AX_THREAD_TEXT_APIS):
- We never included the AXAttachment attribute in attributed strings that
include attachments, like images. This is
expected to be an AXUIElement. With this commit, we include this attribute.
- When posting AXSelectedTextChanged notifications, we must include a valid
text marker range, or else VoiceOver won't
speak anything. We were failing to create a valid text marker range from
VisiblePositions associated with replaced
elements because AXObjectCache::textMarkerDataForVisiblePosition exited
early for anything that wasn't a RenderText,
which is a problem for things like images and another replaced elements.
Fix this by special-casing replaced elements
in AXObjectCache::textMarkerDataForVisiblePosition.
- In AXTextMarkerRange::toAttributedString, we would create our result
attributed string based on the text produced
by the |start| marker. But if the start marker object produced no text,
like in the case of a marker with offset 1
in a replaced element, a nil attributed string would be created. Then
subsequent attempts to append more attributed
strings would fail because they were trying to append to a nil attributed
string. Fix this by making an append method
that detects this scenario.
The two new tests cover all three bugs.
* LayoutTests/accessibility/mac/attributed-string-with-image-expected.txt:
Added.
* LayoutTests/accessibility/mac/attributed-string-with-image.html: Added.
* LayoutTests/accessibility/mac/replaced-element-text-selection-expected.txt:
Added.
* LayoutTests/accessibility/mac/replaced-element-text-selection.html: Added.
* Source/WebCore/accessibility/AXCoreObject.cpp:
(WebCore::AXCoreObject::isReplacedElement const):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textRuns):
* Source/WebCore/accessibility/cocoa/AXCoreObjectCocoa.mm:
(WebCore::AXCoreObject::createAttributedString const):
* Source/WebCore/accessibility/cocoa/AXTextMarkerCocoa.mm:
(WebCore::AXTextMarkerRange::toAttributedString const):
* Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::createJSStringRef):
Canonical link: https://commits.webkit.org/293443@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