mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1686123: Fall back to ARIAGrid*Accessible for HTML table/tbody/thead/tr/td/th elements with no frame. r=morgan
display: contents means there is no frame, which means we can't use HTMLTable*Accessible. However, we can (and should) use ARIAGrid*Accessible in this case. Differential Revision: https://phabricator.services.mozilla.com/D107407
This commit is contained in:
parent
d795f5b731
commit
cf3391de9a
@ -450,7 +450,7 @@ MARKUPMAP(
|
||||
MARKUPMAP(
|
||||
table,
|
||||
[](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* {
|
||||
if (aElement->GetPrimaryFrame() &&
|
||||
if (!aElement->GetPrimaryFrame() ||
|
||||
aElement->GetPrimaryFrame()->AccessibleType() != eHTMLTableType) {
|
||||
return new ARIAGridAccessibleWrap(aElement, aContext->Document());
|
||||
}
|
||||
@ -488,10 +488,9 @@ MARKUPMAP(
|
||||
// cell accessible, because there's no underlying table layout and
|
||||
// thus native HTML table cell class doesn't work. The same is
|
||||
// true if the cell itself has CSS display:block;.
|
||||
if (!aContext->IsHTMLTableRow() ||
|
||||
(aElement->GetPrimaryFrame() &&
|
||||
aElement->GetPrimaryFrame()->AccessibleType() !=
|
||||
eHTMLTableCellType)) {
|
||||
if (!aContext->IsHTMLTableRow() || !aElement->GetPrimaryFrame() ||
|
||||
aElement->GetPrimaryFrame()->AccessibleType() !=
|
||||
eHTMLTableCellType) {
|
||||
return new ARIAGridCellAccessibleWrap(aElement, aContext->Document());
|
||||
}
|
||||
if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::scope)) {
|
||||
@ -538,14 +537,14 @@ MARKUPMAP(
|
||||
if (table) {
|
||||
nsIContent* parentContent = aElement->GetParent();
|
||||
nsIFrame* parentFrame = parentContent->GetPrimaryFrame();
|
||||
if (parentFrame && !parentFrame->IsTableWrapperFrame()) {
|
||||
if (!parentFrame || !parentFrame->IsTableWrapperFrame()) {
|
||||
parentContent = parentContent->GetParent();
|
||||
parentFrame = parentContent->GetPrimaryFrame();
|
||||
if (table->GetContent() == parentContent &&
|
||||
((parentFrame && !parentFrame->IsTableWrapperFrame()) ||
|
||||
(aElement->GetPrimaryFrame() &&
|
||||
aElement->GetPrimaryFrame()->AccessibleType() !=
|
||||
eHTMLTableRowType))) {
|
||||
((!parentFrame || !parentFrame->IsTableWrapperFrame()) ||
|
||||
!aElement->GetPrimaryFrame() ||
|
||||
aElement->GetPrimaryFrame()->AccessibleType() !=
|
||||
eHTMLTableRowType)) {
|
||||
return new ARIARowAccessible(aElement, aContext->Document());
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,18 @@ function doTest() {
|
||||
] };
|
||||
testAccessibleTree("ul", tree);
|
||||
|
||||
tree =
|
||||
{ TABLE: [
|
||||
{ ROW: [
|
||||
{ CELL: [{ TEXT_LEAF: [] } ] },
|
||||
{ CELL: [{ TEXT_LEAF: [] } ] },
|
||||
]},
|
||||
] };
|
||||
testAccessibleTree("tableTableContents", tree);
|
||||
testAccessibleTree("tableTbodyContents", tree);
|
||||
testAccessibleTree("tableTrContents", tree);
|
||||
testAccessibleTree("tableTdContents", tree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -45,5 +57,25 @@ addA11yLoadEvent(doTest);
|
||||
<li>Supermarket 1</li>
|
||||
<li>Supermarket 2</li>
|
||||
</ul>
|
||||
|
||||
<!-- The summary attribute in these tables ensures they are treated as data
|
||||
tables. -->
|
||||
<table id="tableTableContents" summary="summary" style="display: contents;">
|
||||
<tr><td>a</td><td>b</td></tr>
|
||||
</table>
|
||||
<table id="tableTbodyContents" summary="summary" style="display: block;">
|
||||
<tbody style="display: contents;">
|
||||
<tr><td>a</td><td>b</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="tableTrContents" summary="table" style="display: block;">
|
||||
<tr style="display: contents;"><td>a</td><td>b</td></tr>
|
||||
</table>
|
||||
<table id="tableTdContents" summary="summary">
|
||||
<tr>
|
||||
<td style="display: contents;">a</td>
|
||||
<td style="display: contents;">b</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user