Bug 813508 - no need in special HTML caption processing for accessible tree creation, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-11-27 13:59:39 +09:00
Родитель 321d58af6d
Коммит a6f5e9e389
2 изменённых файлов: 90 добавлений и 77 удалений

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

@ -901,28 +901,11 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
newAcc = CreateHTMLAccessibleByMarkup(frame, content, aDoc,
legalPartOfHTMLTable);
if (!newAcc && (!partOfHTMLTable || legalPartOfHTMLTable)) {
// Do not create accessible object subtrees for non-rendered table
// captions. This could not be done in
// nsTableCaptionFrame::GetAccessible() because the descendants of
// the table caption would still be created. By setting
// *aIsSubtreeHidden = true we ensure that no descendant accessibles
// are created.
if (frame->GetType() == nsGkAtoms::tableCaptionFrame &&
frame->GetRect().IsEmpty()) {
// XXX This is not the ideal place for this code, but right now there
// is no better place:
if (aIsSubtreeHidden)
*aIsSubtreeHidden = true;
return nullptr;
}
// Try using frame to do it.
if (!newAcc && (!partOfHTMLTable || legalPartOfHTMLTable))
newAcc = CreateAccessibleByFrameType(frame, content, aDoc);
}
}
}
if (!newAcc) {
// Elements may implement nsIAccessibleProvider via XBL. This allows them to

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

@ -17,68 +17,76 @@
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// table1
// tables having captions
var accTree = {
role: ROLE_TABLE,
children: [
// Two captions, first is used, second is ignored.
var accTree =
{ TABLE: [
{ CAPTION: [
{
role: ROLE_CAPTION,
children: [
{
role: ROLE_TEXT_LEAF
role: ROLE_TEXT_LEAF,
name: "caption"
}
]
},
{
role: ROLE_ROW,
children: [
{
role: ROLE_COLUMNHEADER
},
{
role: ROLE_COLUMNHEADER
}
]
},
{
role: ROLE_ROW,
children: [
{
role: ROLE_CELL
},
{
role: ROLE_CELL
}
]
},
{
role: ROLE_ROW,
children: [
{
role: ROLE_CELL
},
{
role: ROLE_CELL
}
]
},
{
role: ROLE_ROW,
children: [
{
role: ROLE_CELL
},
{
role: ROLE_CELL
}
]
}
]
};
] },
{ ROW: [
{ COLUMNHEADER: [ { TEXT_LEAF: [ ] } ] },
{ COLUMNHEADER: [ { TEXT_LEAF: [ ] } ] }
] },
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] },
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] },
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] }
] };
testAccessibleTree("table", accTree);
// One caption, empty text, caption is ignored.
accTree =
{ TABLE: [
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] }
] };
testAccessibleTree("table_caption_empty", accTree);
// Two captions, first has empty text, both are ignored.
accTree =
{ TABLE: [
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] }
] };
testAccessibleTree("table_caption_firstempty", accTree);
// One caption, placed in the end of table. In use.
accTree =
{ TABLE: [
{ CAPTION: [
{
role: ROLE_TEXT_LEAF,
name: "caption"
}
] },
{ ROW: [
{ CELL: [ { TEXT_LEAF: [ ] } ] },
{ CELL: [ { TEXT_LEAF: [ ] } ] }
] }
] };
testAccessibleTree("table_caption_intheend", accTree);
//////////////////////////////////////////////////////////////////////////
// table2 (consist of one column)
@ -187,6 +195,28 @@
</tfoot>
</table>
<table id="table_caption_empty">
<caption></caption>
<tr>
<td>cell1</td><td>cell2</td>
</tr>
</table>
<table id="table_caption_firstempty">
<caption></caption>
<tr>
<td>cell1</td><td>cell2</td>
</tr>
<caption>caption</caption>
</table>
<table id="table_caption_intheend">
<tr>
<td>cell1</td><td>cell2</td>
</tr>
<caption>caption</caption>
</table>
<table id="table2">
<thead>
<tr>