Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
AX: Properly expose lists that have display:contents list items
https://bugs.webkit.org/show_bug.cgi?id=255325 rdar://problem/107924637 Reviewed by Andres Gonzalez. <div role="list" id="list"> <li style="display:contents">One</li> <li style="display:contents">Two</li> </div> Prior to this patch, we didn't expose this as a list because `AccessibilityList::determineAccessibilityRole()` required renderers for its children which is not valid in the case of display:contents. This patch also features two other display:contents improvements: 1. display:contents elements will now be properly ignored when visibility:hidden 2. AXCoreObject::isLoaded will now do the right thing for display:contents elements * LayoutTests/accessibility/display-contents-list-expected.txt: Added. * LayoutTests/accessibility/display-contents-list.html: Added. * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::createFromNode): (WebCore::AXObjectCache::getOrCreate): * Source/WebCore/accessibility/AccessibilityList.cpp: (WebCore::AccessibilityList::isUnorderedList const): (WebCore::AccessibilityList::isOrderedList const): (WebCore::AccessibilityList::isDescriptionList const): (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): (WebCore::AccessibilityList::determineAccessibilityRole): * Source/WebCore/accessibility/AccessibilityList.h: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::create): * Source/WebCore/accessibility/AccessibilityNodeObject.h: * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isLoaded const): (WebCore::AccessibilityObject::defaultObjectInclusion const): * Source/WebCore/accessibility/AccessibilityObject.h: * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::defaultObjectInclusion const): (WebCore::AccessibilityRenderObject::isLoaded const): Deleted. * Source/WebCore/accessibility/AccessibilityRenderObject.h: Canonical link: https://commits.webkit.org/262889@main
- Loading branch information
Showing
11 changed files
with
106 additions
and
67 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
LayoutTests/accessibility/display-contents-list-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,14 @@ | ||
This test ensures we properly expose lists and list items with display:contents. | ||
|
||
PASS: accessibilityController.accessibleElementById('list').role.includes('List') === true | ||
Adding display:contents and visibility:hidden to #list. | ||
PASS: #list is ignored. | ||
Making #list visibility:visible. | ||
PASS: accessibilityController.accessibleElementById('list').role.includes('List') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
One | ||
Two | ||
|
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,42 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
|
||
<div role="list" id="list"> | ||
<li style="display:contents">One</li> | ||
<li style="display:contents">Two</li> | ||
</div> | ||
|
||
<script> | ||
var output = "This test ensures we properly expose lists and list items with display:contents.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
output += expect("accessibilityController.accessibleElementById('list').role.includes('List')", "true"); | ||
|
||
output += "Adding display:contents and visibility:hidden to #list.\n" | ||
// Ensure visibility:hidden works for display:contents elements. | ||
document.getElementById("list").style.display = "contents"; | ||
document.getElementById("list").style.visibility = "hidden"; | ||
|
||
setTimeout(async function() { | ||
await waitFor(() => !accessibilityController.accessibleElementById("list")); | ||
output += "PASS: #list is ignored.\n" | ||
|
||
output += "Making #list visibility:visible.\n" | ||
document.getElementById("list").style.visibility = "visible"; | ||
await waitFor(() => accessibilityController.accessibleElementById("list")); | ||
output += expect("accessibilityController.accessibleElementById('list').role.includes('List')", "true"); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
</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