Bug 409009 Table cells should have a table in their ancestry, r=evan.yan, a=beltzner
--- a/accessible/src/base/nsAccessibilityAtomList.h
+++ b/accessible/src/base/nsAccessibilityAtomList.h
@@ -77,16 +77,18 @@ ACCESSIBILITY_ATOM(deckFrame, "DeckFrame
ACCESSIBILITY_ATOM(inlineBlockFrame, "InlineBlockFrame")
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
ACCESSIBILITY_ATOM(scrollFrame, "ScrollFrame")
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
ACCESSIBILITY_ATOM(tableCaptionFrame, "TableCaptionFrame")
ACCESSIBILITY_ATOM(tableCellFrame, "TableCellFrame")
ACCESSIBILITY_ATOM(tableOuterFrame, "TableOuterFrame")
+ACCESSIBILITY_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
+ACCESSIBILITY_ATOM(tableRowFrame, "TableRowFrame")
// Alphabetical list of tag names
ACCESSIBILITY_ATOM(a, "a")
ACCESSIBILITY_ATOM(abbr, "abbr")
ACCESSIBILITY_ATOM(acronym, "acronym")
ACCESSIBILITY_ATOM(area, "area")
ACCESSIBILITY_ATOM(autocomplete, "autocomplete")
ACCESSIBILITY_ATOM(blockquote, "blockquote")
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1390,51 +1390,49 @@ NS_IMETHODIMP nsAccessibilityService::Ge
nsIAccessibleRole::ROLE_EQUATION);
}
} else if (!newAcc) { // HTML accessibles
PRBool tryTagNameOrFrame = PR_TRUE;
if (!content->IsFocusable()) {
// If we're in unfocusable table-related subcontent, check for the
// Presentation role on the containing table
- nsIAtom *tag = content->Tag();
- if (tag == nsAccessibilityAtoms::td ||
- tag == nsAccessibilityAtoms::th ||
- tag == nsAccessibilityAtoms::tr ||
- tag == nsAccessibilityAtoms::tbody ||
- tag == nsAccessibilityAtoms::tfoot ||
- tag == nsAccessibilityAtoms::thead) {
+ if (frame->GetType() == nsAccessibilityAtoms::tableCaptionFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableCellFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableRowGroupFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableRowFrame) {
+
nsIContent *tableContent = content;
- nsAutoString tableRole;
while ((tableContent = tableContent->GetParent()) != nsnull) {
- if (tableContent->Tag() == nsAccessibilityAtoms::table) {
+ nsIFrame *tableFrame = aPresShell->GetPrimaryFrameFor(tableContent);
+ if (tableFrame &&
+ tableFrame->GetType() == nsAccessibilityAtoms::tableOuterFrame) {
// Table that we're a descendant of is not styled as a table,
// and has no table accessible for an ancestor, or
// table that we're a descendant of is presentational
nsCOMPtr<nsIDOMNode> tableNode(do_QueryInterface(tableContent));
if (tableNode) {
nsRoleMapEntry *tableRoleMapEntry =
nsAccUtils::GetRoleMapEntry(tableNode);
if (tableRoleMapEntry &&
- tableRoleMapEntry != &nsARIAMap::gLandmarkRoleMap) {
+ tableRoleMapEntry != &nsARIAMap::gLandmarkRoleMap)
tryTagNameOrFrame = PR_FALSE;
- break;
- }
- }
-
- nsIFrame *tableFrame =
- aPresShell->GetPrimaryFrameFor(tableContent);
- if (!tableFrame ||
- tableFrame->GetType() != nsAccessibilityAtoms::tableOuterFrame) {
- tryTagNameOrFrame = PR_FALSE;
}
break;
}
+
+ if (tableContent->Tag() == nsAccessibilityAtoms::table) {
+ tryTagNameOrFrame = PR_FALSE;
+ break;
+ }
}
+
+ if (!tableContent)
+ tryTagNameOrFrame = PR_FALSE;
}
}
if (tryTagNameOrFrame) {
// Prefer to use markup (mostly tag name, perhaps attributes) to
// decide if and what kind of accessible to create.
// The method creates accessibles for table related content too therefore
// we do not call it if accessibles for table related content are