Title: [188769] trunk
Revision
188769
Author
[email protected]
Date
2015-08-21 12:55:53 -0700 (Fri, 21 Aug 2015)

Log Message

AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
https://bugs.webkit.org/show_bug.cgi?id=148293

Patch by Doug Russell <[email protected]> on 2015-08-21
Reviewed by Chris Fleizach.

When RenderTableRows are anonymous, they may not be added to the accessible data
table's internal row list. However, when calculating the row range for a cell,
we were still accounting for those anonymous sections.
Change how the row range is calculated to directly ask the accessible parent row
for its index. This will ensure it’s more inline with what’s being represented to
the accessibility API.

Source/WebCore:

Test: accessibility/aria-table-content.html

* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::parentRow):
(WebCore::AccessibilityTableCell::rowIndexRange):
* accessibility/AccessibilityTableCell.h:

LayoutTests:

* accessibility/aria-table-content-expected.txt: Added.
* accessibility/aria-table-content.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188768 => 188769)


--- trunk/LayoutTests/ChangeLog	2015-08-21 19:36:58 UTC (rev 188768)
+++ trunk/LayoutTests/ChangeLog	2015-08-21 19:55:53 UTC (rev 188769)
@@ -1,3 +1,20 @@
+2015-08-21  Doug Russell  <[email protected]>
+
+        AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
+        https://bugs.webkit.org/show_bug.cgi?id=148293
+
+        Reviewed by Chris Fleizach.
+
+        When RenderTableRows are anonymous, they may not be added to the accessible data 
+        table's internal row list. However, when calculating the row range for a cell, 
+        we were still accounting for those anonymous sections.
+        Change how the row range is calculated to directly ask the accessible parent row 
+        for its index. This will ensure it’s more inline with what’s being represented to 
+        the accessibility API.
+
+        * accessibility/aria-table-content-expected.txt: Added.
+        * accessibility/aria-table-content.html: Added.
+
 2015-08-21  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: REGRESSION(173684): Edit as HTML not working

Added: trunk/LayoutTests/accessibility/aria-table-content-expected.txt (0 => 188769)


--- trunk/LayoutTests/accessibility/aria-table-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-table-content-expected.txt	2015-08-21 19:55:53 UTC (rev 188769)
@@ -0,0 +1,16 @@
+Header
+Item 1
+
+This tests that in an aria table with CSS that makes a row anonymous, the cells can be accessed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS cell00.role is 'AXRole: AXCell'
+PASS cell01.role is 'AXRole: AXCell'
+PASS cell00.isEqual(table.rowAtIndex(0).childAtIndex(0)) is true
+PASS cell01.isEqual(table.rowAtIndex(1).childAtIndex(0)) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/aria-table-content.html (0 => 188769)


--- trunk/LayoutTests/accessibility/aria-table-content.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-table-content.html	2015-08-21 19:55:53 UTC (rev 188769)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style type="text/css">
+  div.foo table:not(.no-header):before{content:'';}
+</style>
+<title>Table Anonymous Row</title>
+</head>
+<body>
+<div class="foo" role="grid" id="table">
+  <table>
+	<thead> <tr> <th>Header</th> </tr> </thead>
+	<tbody> <tr> <td> <p>Item 1</p> </td> </tr> </tbody>
+  </table>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("This tests that in an aria table with CSS that makes a row anonymous, the cells can be accessed.");
+
+if (window.accessibilityController) {
+    var table = accessibilityController.accessibleElementById("table");
+    var cell00 = table.cellForColumnAndRow(0,0);
+    shouldBe("cell00.role", "'AXRole: AXCell'");
+    var cell01 = table.cellForColumnAndRow(0,1);
+    shouldBe("cell01.role", "'AXRole: AXCell'");
+    shouldBeTrue("cell00.isEqual(table.rowAtIndex(0).childAtIndex(0))");
+    shouldBeTrue("cell01.isEqual(table.rowAtIndex(1).childAtIndex(0))");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (188768 => 188769)


--- trunk/Source/WebCore/ChangeLog	2015-08-21 19:36:58 UTC (rev 188768)
+++ trunk/Source/WebCore/ChangeLog	2015-08-21 19:55:53 UTC (rev 188769)
@@ -1,3 +1,24 @@
+2015-08-21  Doug Russell  <[email protected]>
+
+        AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow
+        https://bugs.webkit.org/show_bug.cgi?id=148293
+
+        Reviewed by Chris Fleizach.
+
+        When RenderTableRows are anonymous, they may not be added to the accessible data 
+        table's internal row list. However, when calculating the row range for a cell, 
+        we were still accounting for those anonymous sections.
+        Change how the row range is calculated to directly ask the accessible parent row 
+        for its index. This will ensure it’s more inline with what’s being represented to 
+        the accessibility API.
+
+        Test: accessibility/aria-table-content.html
+
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::parentRow):
+        (WebCore::AccessibilityTableCell::rowIndexRange):
+        * accessibility/AccessibilityTableCell.h:
+
 2015-08-21  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: REGRESSION(173684): Edit as HTML not working

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (188768 => 188769)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2015-08-21 19:36:58 UTC (rev 188768)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2015-08-21 19:55:53 UTC (rev 188769)
@@ -302,41 +302,25 @@
             headers.append(tableCell);
     }
 }
-    
+
+AccessibilityTableRow* AccessibilityTableCell::parentRow() const
+{
+    AccessibilityObject* parent = parentObjectUnignored();
+    if (!is<AccessibilityTableRow>(*parent))
+        return nullptr;
+    return downcast<AccessibilityTableRow>(parent);
+}
+
 void AccessibilityTableCell::rowIndexRange(std::pair<unsigned, unsigned>& rowRange) const
 {
     if (!is<RenderTableCell>(m_renderer))
         return;
     
     RenderTableCell& renderCell = downcast<RenderTableCell>(*m_renderer);
-    rowRange.first = renderCell.rowIndex();
     rowRange.second = renderCell.rowSpan();
     
-    // since our table might have multiple sections, we have to offset our row appropriately
-    RenderTableSection* section = renderCell.section();
-    RenderTable* table = renderCell.table();
-    if (!table || !section)
-        return;
-
-    RenderTableSection* footerSection = table->footer();
-    unsigned rowOffset = 0;
-    for (RenderTableSection* tableSection = table->topSection(); tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
-        // Don't add row offsets for bottom sections that are placed in before the body section.
-        if (tableSection == footerSection)
-            continue;
-        if (tableSection == section) {
-            // If the table section is anonymous, we should to use the parent row's API to get the rowIndex
-            if (tableSection->isAnonymous()) {
-                AccessibilityObject* parent = parentObjectUnignored();
-                if (is<AccessibilityTableRow>(*parent))
-                    rowOffset = downcast<AccessibilityTableRow>(*parent).rowIndex();
-            }
-            break;
-        }
-        rowOffset += tableSection->numRows();
-    }
-
-    rowRange.first += rowOffset;
+    if (AccessibilityTableRow* parentRow = this->parentRow())
+        rowRange.first = parentRow->rowIndex();
 }
     
 void AccessibilityTableCell::columnIndexRange(std::pair<unsigned, unsigned>& columnRange) const

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.h (188768 => 188769)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.h	2015-08-21 19:36:58 UTC (rev 188768)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.h	2015-08-21 19:55:53 UTC (rev 188769)
@@ -34,7 +34,8 @@
 namespace WebCore {
     
 class AccessibilityTable;
-    
+class AccessibilityTableRow;
+
 class AccessibilityTableCell : public AccessibilityRenderObject {
 public:
     static Ref<AccessibilityTableCell> create(RenderObject*);
@@ -56,6 +57,7 @@
 protected:
     explicit AccessibilityTableCell(RenderObject*);
 
+    AccessibilityTableRow* parentRow() const;
     virtual AccessibilityTable* parentTable() const;
     virtual AccessibilityRole determineAccessibilityRole() override final;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to