Bug 1053765 - Putting role=log on a table tag breaks row and cell accessibles, r=tbsaunde

This commit is contained in:
Alexander Surkov 2014-08-15 16:49:02 -04:00
parent fcb6f98d56
commit ef0231619d
4 changed files with 24 additions and 3 deletions

View File

@ -972,10 +972,10 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
// If table has strong ARIA role then all table descendants shouldn't
// expose their native roles.
if (!roleMapEntry && newAcc) {
if (!roleMapEntry && newAcc && aContext->HasStrongARIARole()) {
if (frame->AccessibleType() == eHTMLTableRowType) {
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
if (contextRoleMap && !(contextRoleMap->IsOfType(eTable)))
if (!contextRoleMap->IsOfType(eTable))
roleMapEntry = &aria::gEmptyRoleMap;
} else if (frame->AccessibleType() == eHTMLTableCellType &&
@ -987,7 +987,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
content->Tag() == nsGkAtoms::dd ||
frame->AccessibleType() == eHTMLLiType) {
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
if (contextRoleMap && !(contextRoleMap->IsOfType(eList)))
if (!contextRoleMap->IsOfType(eList))
roleMapEntry = &aria::gEmptyRoleMap;
}
}

View File

@ -28,6 +28,12 @@ Accessible::IsARIARole(nsIAtom* aARIARole) const
return mRoleMapEntry && mRoleMapEntry->Is(aARIARole);
}
inline bool
Accessible::HasStrongARIARole() const
{
return mRoleMapEntry && mRoleMapEntry->roleRule == kUseMapRole;
}
inline mozilla::a11y::role
Accessible::ARIARole()
{

View File

@ -219,6 +219,7 @@ public:
*/
bool HasARIARole() const { return mRoleMapEntry; }
bool IsARIARole(nsIAtom* aARIARole) const;
bool HasStrongARIARole() const;
/**
* Retrun ARIA role map if any.

View File

@ -162,6 +162,18 @@
};
testAccessibleTree("table5", accTree);
/////////////////////////////////////////////////////////////////////////
// log table
accTree =
{ TABLE: [
{ ROW: [
{ CELL: [
{ TEXT_LEAF: [ ] }
] }
] }
] };
testAccessibleTree("logtable", accTree);
SimpleTest.finish();
}
@ -264,5 +276,7 @@
</tr>
</tbody>
</table>
<table id="logtable" role="log"><tr><td>blah</td></tr></table>
</body>
</html>