-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX ITM: VoiceOver only reading "link" for some lines when navigating …
…via arrow up and down in contenteditables. https://bugs.webkit.org/show_bug.cgi?id=259310 rdar://112157851 Reviewed by Tyler Wilcock. The problem occurs for any <contenteditable> that contains children, e.g., a link or a span. We were returning nil for the AttributedString corresponding to the range of a line containing a child of the contenteditable. With this patch, if the range is not confined to a single object for which we cache the AttributedString, we fallback to the live objects to extract the attributedString. In addition, this patch adds several TextMarker related methods to WTR::AccessibilityUIElement for testing purpose. * LayoutTests/accessibility/mac/content-editable-attributed-string-expected.txt: Added. * LayoutTests/accessibility/mac/content-editable-attributed-string.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/accessibility/AXTextMarker.cpp: (WebCore::AXTextMarker::debugDescription const): * Source/WebCore/accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm: (WebCore::AXIsolatedObject::attributedStringForTextMarkerRange const): * Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: (WTR::AccessibilityUIElement::rightLineTextMarkerRangeForTextMarker): (WTR::AccessibilityUIElement::leftLineTextMarkerRangeForTextMarker): (WTR::AccessibilityUIElement::previousLineStartTextMarkerForTextMarker): (WTR::AccessibilityUIElement::nextLineEndTextMarkerForTextMarker): * Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: * Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): (WTR::AccessibilityUIElement::rightLineTextMarkerRangeForTextMarker): (WTR::AccessibilityUIElement::leftLineTextMarkerRangeForTextMarker): (WTR::AccessibilityUIElement::previousLineStartTextMarkerForTextMarker): (WTR::AccessibilityUIElement::nextLineEndTextMarkerForTextMarker): (WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): (WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Canonical link: https://commits.webkit.org/266138@main
- Loading branch information
1 parent
7f4d021
commit e9f264d
Showing
9 changed files
with
167 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
LayoutTests/accessibility/mac/content-editable-attributed-string-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Tests that AttributedStrings are retrieved properly from line ranges within a contenteditable with children. | ||
|
||
All text in the contenteditable: "AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, First line. | ||
Some text click me more text. | ||
Another line." | ||
First line: "AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, First line." | ||
Second line: "AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, AXFont - { | ||
AXFontFamily = Times; | ||
AXFontName = "Times-Roman"; | ||
AXFontSize = 16; | ||
}, Some text click me more text." | ||
third line: "AXFont - { | ||
AXFontFamily = Times; | ||
AXFontItalic = 1; | ||
AXFontName = "Times-Italic"; | ||
AXFontSize = 16; | ||
}, Another line." | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
First line. | ||
Some text click me more text. | ||
Another line. |
46 changes: 46 additions & 0 deletions
46
LayoutTests/accessibility/mac/content-editable-attributed-string.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
<script src="../../resources/accessibility-helper.js"></script> | ||
</head> | ||
<body> | ||
|
||
<div contenteditable id="editable">First line.<br>Some text <a href="#">click me</a> <span>more</span> text.<br><i>Another line.</i></div> | ||
|
||
<script> | ||
if (accessibilityController) { | ||
let output = "Tests that AttributedStrings are retrieved properly from line ranges within a contenteditable with children.\n\n"; | ||
|
||
let text = accessibilityController.accessibleElementById("editable"); | ||
let range = text.textMarkerRangeForElement(text); | ||
let string = text.attributedStringForTextMarkerRange(range); | ||
output += `All text in the contenteditable: "${string}"\n`; | ||
|
||
// Get the range for the first line. | ||
let start = text.startTextMarkerForTextMarkerRange(range); | ||
range = text.lineTextMarkerRangeForTextMarker(start); | ||
string = text.attributedStringForTextMarkerRange(range); | ||
output += `First line: "${string}"\n`; | ||
|
||
// Get the range for the second line: | ||
let end = text.nextLineEndTextMarkerForTextMarker(start); | ||
end = text.nextTextMarker(end); | ||
end = text.nextTextMarker(end); | ||
range = text.lineTextMarkerRangeForTextMarker(end); | ||
string = text.attributedStringForTextMarkerRange(range); | ||
output += `Second line: "${string}"\n`; | ||
|
||
// Get the range for the third line: | ||
end = text.nextLineEndTextMarkerForTextMarker(end); | ||
end = text.nextTextMarker(end); | ||
end = text.nextTextMarker(end); | ||
range = text.lineTextMarkerRangeForTextMarker(end); | ||
string = text.attributedStringForTextMarkerRange(range); | ||
output += `third line: "${string}"\n`; | ||
|
||
debug(output); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters