mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 704465 - Table headers not associated when header is a td element with no scope, r=tbsaunde
This commit is contained in:
parent
4f491064ec
commit
05975ea879
@ -47,7 +47,7 @@ TableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
// Move to the left to find row header cells
|
||||
// Move up to find column header cells
|
||||
for (uint32_t curRowIdx = rowIdx - 1; curRowIdx < rowIdx; curRowIdx--) {
|
||||
Accessible* cell = table->CellAt(curRowIdx, colIdx);
|
||||
if (!cell)
|
||||
|
@ -213,9 +213,18 @@ void
|
||||
HTMLTableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
|
||||
{
|
||||
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
||||
while (Accessible* cell = itr.Next())
|
||||
if (cell->Role() == roles::COLUMNHEADER)
|
||||
while (Accessible* cell = itr.Next()) {
|
||||
a11y::role cellRole = cell->Role();
|
||||
if (cellRole == roles::COLUMNHEADER) {
|
||||
aCells->AppendElement(cell);
|
||||
} else if (cellRole != roles::ROWHEADER) {
|
||||
// If referred table cell is at the same column then treat it as a column
|
||||
// header.
|
||||
TableCellAccessible* tableCell = cell->AsTableCell();
|
||||
if (tableCell && tableCell->ColIdx() == ColIdx())
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
|
||||
if (aCells->IsEmpty())
|
||||
TableCellAccessible::ColHeaderCells(aCells);
|
||||
@ -225,9 +234,18 @@ void
|
||||
HTMLTableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells)
|
||||
{
|
||||
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
||||
while (Accessible* cell = itr.Next())
|
||||
if (cell->Role() == roles::ROWHEADER)
|
||||
while (Accessible* cell = itr.Next()) {
|
||||
a11y::role cellRole = cell->Role();
|
||||
if (cellRole == roles::ROWHEADER) {
|
||||
aCells->AppendElement(cell);
|
||||
} else if (cellRole != roles::COLUMNHEADER) {
|
||||
// If referred table cell is at the same row then treat it as a column
|
||||
// header.
|
||||
TableCellAccessible* tableCell = cell->AsTableCell();
|
||||
if (tableCell && tableCell->RowIdx() == RowIdx())
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
|
||||
if (aCells->IsEmpty())
|
||||
TableCellAccessible::RowHeaderCells(aCells);
|
||||
@ -294,7 +312,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
||||
return roles::ROWHEADER;
|
||||
}
|
||||
|
||||
// Assume it's columnheader if there are headers in siblings, oterwise
|
||||
// Assume it's columnheader if there are headers in siblings, otherwise
|
||||
// rowheader.
|
||||
nsIContent* parentContent = mContent->GetParent();
|
||||
if (!parentContent) {
|
||||
@ -306,7 +324,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
||||
siblingContent = siblingContent->GetPreviousSibling()) {
|
||||
if (siblingContent->IsElement()) {
|
||||
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +332,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
||||
siblingContent = siblingContent->GetNextSibling()) {
|
||||
if (siblingContent->IsElement()) {
|
||||
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,19 @@
|
||||
|
||||
testHeaderCells(headerInfoMap);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// @headers points to table cells
|
||||
|
||||
headerInfoMap = [
|
||||
{
|
||||
cell: "table6_cell",
|
||||
rowHeaderCells: [ "table6_rh" ],
|
||||
columnHeaderCells: [ "table6_ch" ]
|
||||
}
|
||||
];
|
||||
|
||||
testHeaderCells(headerInfoMap);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -154,7 +167,14 @@
|
||||
<body>
|
||||
<a target="_blank"
|
||||
title="implement IAccessibleTable2"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">
|
||||
Bug 512424
|
||||
</a>
|
||||
<a target="_blank"
|
||||
title="Table headers not associated when header is a td element with no scope"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=704465">
|
||||
Bug 704465
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
@ -244,5 +264,16 @@
|
||||
<td id="table5_cell">cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="table6">
|
||||
<tr>
|
||||
<td>empty cell</th>
|
||||
<td id="table6_ch">colheader</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="table6_rh">rowheader</th>
|
||||
<td id="table6_cell" headers="table6_ch table6_rh">cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user