mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +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)
|
if (!table)
|
||||||
return;
|
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--) {
|
for (uint32_t curRowIdx = rowIdx - 1; curRowIdx < rowIdx; curRowIdx--) {
|
||||||
Accessible* cell = table->CellAt(curRowIdx, colIdx);
|
Accessible* cell = table->CellAt(curRowIdx, colIdx);
|
||||||
if (!cell)
|
if (!cell)
|
||||||
|
@ -213,9 +213,18 @@ void
|
|||||||
HTMLTableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
|
HTMLTableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
|
||||||
{
|
{
|
||||||
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
||||||
while (Accessible* cell = itr.Next())
|
while (Accessible* cell = itr.Next()) {
|
||||||
if (cell->Role() == roles::COLUMNHEADER)
|
a11y::role cellRole = cell->Role();
|
||||||
|
if (cellRole == roles::COLUMNHEADER) {
|
||||||
aCells->AppendElement(cell);
|
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())
|
if (aCells->IsEmpty())
|
||||||
TableCellAccessible::ColHeaderCells(aCells);
|
TableCellAccessible::ColHeaderCells(aCells);
|
||||||
@ -225,9 +234,18 @@ void
|
|||||||
HTMLTableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells)
|
HTMLTableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells)
|
||||||
{
|
{
|
||||||
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
IDRefsIterator itr(mDoc, mContent, nsGkAtoms::headers);
|
||||||
while (Accessible* cell = itr.Next())
|
while (Accessible* cell = itr.Next()) {
|
||||||
if (cell->Role() == roles::ROWHEADER)
|
a11y::role cellRole = cell->Role();
|
||||||
|
if (cellRole == roles::ROWHEADER) {
|
||||||
aCells->AppendElement(cell);
|
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())
|
if (aCells->IsEmpty())
|
||||||
TableCellAccessible::RowHeaderCells(aCells);
|
TableCellAccessible::RowHeaderCells(aCells);
|
||||||
@ -294,7 +312,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
|||||||
return roles::ROWHEADER;
|
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.
|
// rowheader.
|
||||||
nsIContent* parentContent = mContent->GetParent();
|
nsIContent* parentContent = mContent->GetParent();
|
||||||
if (!parentContent) {
|
if (!parentContent) {
|
||||||
@ -306,7 +324,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
|||||||
siblingContent = siblingContent->GetPreviousSibling()) {
|
siblingContent = siblingContent->GetPreviousSibling()) {
|
||||||
if (siblingContent->IsElement()) {
|
if (siblingContent->IsElement()) {
|
||||||
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
||||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +332,7 @@ HTMLTableHeaderCellAccessible::NativeRole()
|
|||||||
siblingContent = siblingContent->GetNextSibling()) {
|
siblingContent = siblingContent->GetNextSibling()) {
|
||||||
if (siblingContent->IsElement()) {
|
if (siblingContent->IsElement()) {
|
||||||
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
return nsCoreUtils::IsHTMLTableHeader(siblingContent) ?
|
||||||
roles::COLUMNHEADER : roles::ROWHEADER;
|
roles::COLUMNHEADER : roles::ROWHEADER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +143,19 @@
|
|||||||
|
|
||||||
testHeaderCells(headerInfoMap);
|
testHeaderCells(headerInfoMap);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// @headers points to table cells
|
||||||
|
|
||||||
|
headerInfoMap = [
|
||||||
|
{
|
||||||
|
cell: "table6_cell",
|
||||||
|
rowHeaderCells: [ "table6_rh" ],
|
||||||
|
columnHeaderCells: [ "table6_ch" ]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
testHeaderCells(headerInfoMap);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +167,14 @@
|
|||||||
<body>
|
<body>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
title="implement IAccessibleTable2"
|
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>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none"></div>
|
<div id="content" style="display: none"></div>
|
||||||
@ -244,5 +264,16 @@
|
|||||||
<td id="table5_cell">cell</td>
|
<td id="table5_cell">cell</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user