-
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: Implement AXStartTextMarkerAttribute and AXEndTextMarkerAttribute…
… off the main-thread https://bugs.webkit.org/show_bug.cgi?id=267944 rdar://problem/121463431 Reviewed by Andres Gonzalez. This patch also reimplements findObjectWithRuns in terms of Accessibility::findMatchingObjects, as the old implementation was implemented in a way that could hit a dead-end despite there being more objects with text runs left to traverse over. This bug is exercised by newly added testcase ax-thread-text-apis/display-contents-end-text-marker.html. * LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker-expected.txt: Added. * LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker.html: Added. * Source/WebCore/accessibility/AXCoreObject.h: Add AccessibilitySearchKey::HasTextRuns. * Source/WebCore/accessibility/AXLogger.cpp: (WebCore::operator<<): * Source/WebCore/accessibility/AXTextMarker.cpp: (WebCore::findObjectWithRuns): (WebCore::AXTextMarker::findLast const): Added. (WebCore::AXTextMarker::findMarker const): Remove redundant RELEASE_ASSERTs. * Source/WebCore/accessibility/AXTextMarker.h: * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::Accessibility::isAccessibilityObjectSearchMatchAtIndex): * Source/WebCore/accessibility/AccessibilityObject.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::sibling const): Add missing nullptr check that was causing crashes due to its absence. * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h: * Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Canonical link: https://commits.webkit.org/273962@main
- Loading branch information
Showing
13 changed files
with
184 additions
and
39 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker-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,15 @@ | ||
This test ensures that computing text markers includes all display:contents text content. | ||
|
||
Web area string for start-to-end text marker range: | ||
|
||
Foo text | ||
This is a table caption | ||
Author Title Year | ||
Stephen Hawking A Brief History of Time 1988 | ||
Carl Sagan Cosmos 1980 | ||
Will Gater The Mysteries of the Universe 2020 | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
65 changes: 65 additions & 0 deletions
65
LayoutTests/accessibility/ax-thread-text-apis/display-contents-end-text-marker.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,65 @@ | ||
<!DOCTYPE HTML><!-- webkit-test-runner [ runSingly=true AccessibilityThreadTextApisEnabled=true ] --> | ||
<!-- Remove this in favor of display-contents/end-text-marker.html after AX_THREAD_TEXT_APIS enabled is the default. --> | ||
<html> | ||
<head> | ||
<script src="../../resources/accessibility-helper.js"></script> | ||
<script src="../../resources/js-test.js"></script> | ||
<style> | ||
td, th { display: contents; } | ||
</style> | ||
</head> | ||
<body id="body" role="group"> | ||
|
||
<div id="test-contents"> | ||
Foo text | ||
|
||
<table> | ||
<caption>This is a table caption</caption> | ||
<thead> | ||
<tr> | ||
<th>Author</th> | ||
<th>Title</th> | ||
<th>Year</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Stephen Hawking</td> | ||
<td>A Brief History of Time</td> | ||
<td>1988</td> | ||
</tr> | ||
<tr> | ||
<td>Carl Sagan</td> | ||
<td>Cosmos</td> | ||
<td>1980</td> | ||
</tr> | ||
<tr> | ||
<td>Will Gater</td> | ||
<td>The Mysteries of the Universe</td> | ||
<td>2020</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<script> | ||
var output = "This test ensures that computing text markers includes all display:contents text content.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
const webArea = accessibilityController.rootElement.childAtIndex(0); | ||
|
||
const startMarker = webArea.startTextMarker; | ||
const endMarker = webArea.endTextMarker; | ||
const textMarkerRange = webArea.textMarkerRangeForMarkers(startMarker, endMarker); | ||
|
||
// Fails because: | ||
// 1. We don't include spaces between cells | ||
// 2. We don't include newline characters between rows | ||
// 3. We miss the table caption text entirely (it is rendered and selectable text, so we should be including it) | ||
output += `Web area string for start-to-end text marker range:\n\n${webArea.stringForTextMarkerRange(textMarkerRange)}\n`; | ||
document.getElementById("test-contents").style.display = "none"; | ||
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
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