Bug 409009 Table cells should have a table in their ancestry, r=evan.yan, a=beltzner
authorsurkov.alexander@gmail.com
Fri, 18 Jan 2008 15:57:57 -0800
changeset 10421 c77c234b2ba9f5fdcd23540c73ac7e346e24c9aa
parent 10420 5734d538913f88af9ac70ac1745cc77279badda9
child 10422 56bdea0329001315f40794edcc05e3d7fd5ffcf9
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherderautoland@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevan.yan, beltzner
bugs409009
milestone1.9b3pre
Bug 409009 Table cells should have a table in their ancestry, r=evan.yan, a=beltzner
accessible/src/base/nsAccessibilityAtomList.h
accessible/src/base/nsAccessibilityService.cpp
--- 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