Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
AccessibilityTable::m_isExposable is never recomputed after Accessibi…
…lityTable::init https://bugs.webkit.org/show_bug.cgi?id=240750 Reviewed by Andres Gonzalez. AccessibilityTable::m_isExposable is never recomputed after AccessibilityTable::init. This is bad because the semantics of table, and the semantics of the table cells in the table, are dependent on whether the table is exposed. With this commit, we recompute m_isExposable when a table's row count changes. This commit also updates the isolated tree for row count changes, meaning we handle dynamic aria-rowcount value modifications. Test: accessibility/table-exposure-updates-dynamically.html. Also added another testcase to accessibility/aria-table-attributes.html. * LayoutTests/accessibility/aria-table-attributes-expected.txt: * LayoutTests/accessibility/aria-table-attributes.html: Add testcase. * LayoutTests/accessibility/table-exposure-updates-dynamically-expected.txt: Added. * LayoutTests/accessibility/table-exposure-updates-dynamically.html: Added. * LayoutTests/platform/glib/accessibility/table-exposure-updates-dynamically-expected.txt: Added. * LayoutTests/platform/ios/TestExpectations: Enable new test. * LayoutTests/platform/ios/accessibility/table-exposure-updates-dynamically-expected.txt: Added. * LayoutTests/platform/win/TestExpectations: Disable new test. * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::remove): (WebCore::AXObjectCache::childrenChanged): (WebCore::AXObjectCache::handleRowCountChanged): Added. (WebCore::AXObjectCache::handleAriaExpandedChange): (WebCore::AXObjectCache::handleAttributeChange): (WebCore::filterWeakHashSetForRemoval): (WebCore::AXObjectCache::prepareForDocumentDestruction): (WebCore::AXObjectCache::performDeferredCacheUpdate): (WebCore::AXObjectCache::updateIsolatedTree): * Source/WebCore/accessibility/AXObjectCache.h: * Source/WebCore/accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::recomputeIsExposable): Added. (WebCore::AccessibilityTable::updateChildrenRoles): Added. (WebCore::AccessibilityTable::addChildren): * Source/WebCore/accessibility/AccessibilityTable.h: * Source/WebCore/html/HTMLTablePartElement.h: Moved findParentTable from protected to public so it can be called from accessibility code. Canonical link: https://commits.webkit.org/251005@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294875 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
13 changed files
with
263 additions
and
70 deletions.
There are no files selected for viewing
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
@@ -0,0 +1,18 @@ | ||
This test ensures a table's "exposed" state (whether it is an accessibility data table, vs. just a layout table) updates in response to dynamic page changes. | ||
|
||
Initial table state has aria-rowcount, so it should be a data table. | ||
#table AXRole: AXTable | ||
#cellOne AXRole: AXCell | ||
|
||
Removing aria-rowcount. Based on this table's contents, it should now become a layout table. | ||
#table AXRole: AXUnknown | ||
#cellOne AXRole: AXGroup | ||
|
||
Adding a lot of rows which should cause the table to become an accessibility data table. | ||
#table AXRole: AXTable | ||
#cellOne AXRole: AXCell | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/js-test.js"></script> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
</head> | ||
<body> | ||
|
||
<table id="table" aria-rowcount="1"> | ||
<tr> | ||
<td id="cellOne">x</td> | ||
<td>x</td> | ||
</tr> | ||
</table> | ||
|
||
<script> | ||
var testOutput = `This test ensures a table's "exposed" state (whether it is an accessibility data table, vs. just a layout table) updates in response to dynamic page changes.\n\n`; | ||
|
||
function createCell() { | ||
const cell = document.createElement("td"); | ||
cell.appendChild(document.createTextNode("Text inside cell")); | ||
return cell; | ||
} | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
|
||
const table = accessibilityController.accessibleElementById("table"); | ||
const cellOne = accessibilityController.accessibleElementById("cellOne"); | ||
testOutput += "Initial table state has aria-rowcount, so it should be a data table.\n"; | ||
testOutput += `#table ${table.role}\n`; | ||
testOutput += `#cellOne ${cellOne.role}\n`; | ||
|
||
testOutput += "\nRemoving aria-rowcount. Based on this table's contents, it should now become a layout table.\n"; | ||
document.getElementById("table").removeAttribute("aria-rowcount"); | ||
setTimeout(async function() { | ||
await waitFor(() => { | ||
return !cellOne.role.includes("Cell") && !table.role.includes("Table"); | ||
}); | ||
testOutput += `#table ${table.role}\n`; | ||
testOutput += `#cellOne ${cellOne.role}\n`; | ||
|
||
testOutput += "\nAdding a lot of rows which should cause the table to become an accessibility data table.\n"; | ||
for (let i = 0; i < 20; i++) { | ||
const row = document.getElementById("table").insertRow(-1); | ||
row.appendChild(createCell()); | ||
row.appendChild(createCell()); | ||
} | ||
|
||
await waitFor(() => { | ||
return table.childrenCount >= 20 && | ||
cellOne.role.includes("Cell") && | ||
table.role.includes("Table"); | ||
}); | ||
testOutput += `#table ${table.role}\n`; | ||
testOutput += `#cellOne ${cellOne.role}\n`; | ||
|
||
document.getElementById("table").style.visibility = "hidden"; | ||
debug(testOutput); | ||
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
@@ -0,0 +1,18 @@ | ||
This test ensures a table's "exposed" state (whether it is an accessibility data table, vs. just a layout table) updates in response to dynamic page changes. | ||
|
||
Initial table state has aria-rowcount, so it should be a data table. | ||
#table AXRole: AXTable | ||
#cellOne AXRole: AXCell | ||
|
||
Removing aria-rowcount. Based on this table's contents, it should now become a layout table. | ||
#table AXRole: AXUnknown | ||
#cellOne AXRole: AXSection | ||
|
||
Adding a lot of rows which should cause the table to become an accessibility data table. | ||
#table AXRole: AXTable | ||
#cellOne AXRole: AXCell | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
@@ -0,0 +1,18 @@ | ||
This test ensures a table's "exposed" state (whether it is an accessibility data table, vs. just a layout table) updates in response to dynamic page changes. | ||
|
||
Initial table state has aria-rowcount, so it should be a data table. | ||
#table Table | ||
#cellOne Cell | ||
|
||
Removing aria-rowcount. Based on this table's contents, it should now become a layout table. | ||
#table Unknown | ||
#cellOne TextGroup | ||
|
||
Adding a lot of rows which should cause the table to become an accessibility data table. | ||
#table Table | ||
#cellOne Cell | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
Oops, something went wrong.