Bug 685218 - Expose layout-guess attribute on HTML tables having @datatable='0' attribute, r=surkov
authorOuss. BADR <oussamabadr@gmail.com>
Wed, 19 Oct 2011 10:36:35 +0900
changeset 78925 5033def96eb60b9e15856e6695fd8861867c7105
parent 78924 7498aeb7541264b800134ada7edcb55f845e0958
child 78927 8bdb43713c4d418a133649358d45f3642a83dc67
push id21350
push usermak77@bonardo.net
push dateWed, 19 Oct 2011 09:48:37 +0000
treeherdermozilla-central@311fdb9b38b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs685218
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 685218 - Expose layout-guess attribute on HTML tables having @datatable='0' attribute, r=surkov
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/tests/mochitest/table/test_layoutguess.html
content/base/src/nsGkAtomList.h
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -1382,16 +1382,22 @@ nsHTMLTableAccessible::IsProbablyForLayo
 
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
     // Role attribute is present, but overridden roles have already been dealt with.
     // Only landmarks and other roles that don't override the role from native
     // markup are left to deal with here.
     RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
   }
 
+  // Check if datatable attribute has "0" value.
+  if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
+                            NS_LITERAL_STRING("0"), eCaseMatters)) {
+    RETURN_LAYOUT_ANSWER(true, "Has datatable = 0 attribute, it's for layout");
+  }
+
   // Check for legitimate data table attributes.
   nsAutoString summary;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
       !summary.IsEmpty())
     RETURN_LAYOUT_ANSWER(false, "Has summary -- legitimate table structures");
 
   // Check for legitimate data table elements.
   nsAccessible* caption = FirstChild();
--- a/accessible/tests/mochitest/table/test_layoutguess.html
+++ b/accessible/tests/mochitest/table/test_layoutguess.html
@@ -18,16 +18,18 @@
     {
       // Attribute we're looking for
       var attr = {
         "layout-guess": "true"
       };
 
       // table with role of grid
       testAbsentAttrs("table1", attr);
+      // table with role of grid and datatable="0"
+      testAbsentAttrs("table1.1", attr);
 
       // table with landmark role
       testAbsentAttrs("table2", attr);
 
       // table with summary
       testAbsentAttrs("table3", attr);
 
       // table with caption
@@ -88,16 +90,19 @@
       // layout table containing nested data table (having data structures)
       testAttrs("table21", attr, true);
       testAttrs("table21.2", attr, true);
       testAttrs("table21.3", attr, true);
       testAttrs("table21.4", attr, true);
       testAttrs("table21.5", attr, true);
       testAttrs("table21.6", attr, true);
 
+      // layout table having datatable="0" attribute and containing data table structure (tfoot element)
+      testAttrs("table22", attr, true);
+
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 <body>
@@ -136,16 +141,22 @@
       <td>June 12</td>
     </tr>
     <tr>
       <td>Alex</td>
       <td>Third test</td>
       <td>June 12</td>
     </tr>
   </table>
+   <!-- table with role of grid and datatable="0"-->
+  <table id="table1.1" role="grid" datatable="0">
+    <tr>
+      <td>Cell1</td><td>cell2</td>
+    </tr>
+  </table>
 
   <!-- table with landmark role -->
   <table id="table2" role="main">
     <tr>
       <th>Sender</th>
       <th>Subject</th>
       <th>Date</th>
     </tr>
@@ -406,10 +417,19 @@
         <table>
           <tfoot>
             <tr><td>Cell</td></tr>
           </tfoot>
         </table>
       </td>
     </tr>
   </table>
+
+  <!-- layout table with datatable="0" and tfoot element-->
+  <table id="table22" datatable="0">
+    <tfoot>
+      <tr>
+        <td>Cell1</td><td>cell2</td>
+      </tr>
+    </tfoot>
+  </table>
 </body>
 </html>
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1972,16 +1972,17 @@ GK_ATOM(backgroundColor, "background-col
 GK_ATOM(checkable, "checkable")
 GK_ATOM(choices, "choices")
 GK_ATOM(containerAtomic, "container-atomic")
 GK_ATOM(containerBusy, "container-busy")
 GK_ATOM(containerLive, "container-live")
 GK_ATOM(containerLiveRole, "container-live-role")
 GK_ATOM(containerRelevant, "container-relevant")
 GK_ATOM(cycles, "cycles")
+GK_ATOM(datatable, "datatable")
 GK_ATOM(droppable, "droppable")
 GK_ATOM(eventFromInput, "event-from-input")
 GK_ATOM(InlineBlockFrame, "InlineBlockFrame")
 GK_ATOM(invalid, "invalid")
 GK_ATOM(item, "item")
 GK_ATOM(itemset, "itemset")
 GK_ATOM(language, "language")
 GK_ATOM(lineNumber, "line-number")