Bug 1802240: Use generic ARIA grid cell accessible for mtd elements without table style, r=Jamie

This revision changes the logic in MathMLMarkupMap such that mtd elements create
generic ARIA grid accessibles if the display style for the element is something
other than 'table'. This revision also adds a test that verifies that the roles
remain as expected, even with this change.

Differential Revision: https://phabricator.services.mozilla.com/D163898
This commit is contained in:
Nathan LaPre 2022-12-06 20:41:44 +00:00
Родитель aa90ca4a4b
Коммит 391c21b2f8
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -81,6 +81,13 @@ MARKUPMAP(
MARKUPMAP(
mtd_,
[](Element* aElement, LocalAccessible* aContext) -> LocalAccessible* {
// If the mtd element in a MathML table has a display style other than
// 'table', create a generic table cell accessible, since there's no
// underlying table layout.
if (!aContext->IsHTMLTableRow() || !aElement->GetPrimaryFrame() ||
aElement->GetPrimaryFrame()->AccessibleType() != eHTMLTableCellType) {
return new ARIAGridCellAccessible(aElement, aContext->Document());
}
return new HTMLTableCellAccessible(aElement, aContext->Document());
},
roles::MATHML_CELL)

Просмотреть файл

@ -60,6 +60,15 @@
testTableStruct("simple_label", cellsArray, kNoColumnHeader,
"", "", kMathTable, rowsArray);
// Test that a non-table display style still generates the proper
// roles in the accessibility tree.
const table_tree = {
MATHML_TABLE: [{
MATHML_TABLE_ROW: [{ MATHML_CELL: [{ TEXT_LEAF: [] }] }]
}],
};
testAccessibleTree("table_with_display_block_mtd", table_tree);
SimpleTest.finish();
}
@ -120,6 +129,12 @@
<mtd><mtext>label</mtext></mtd>
</mlabeledtr>
</mtable>
<mtable id="table_with_display_block_mtd">
<mtr>
<mtd style="display: block">test</mtd>
</mtr>
</mtable>
</math>
</body>