Title: [163320] trunk
Revision
163320
Author
cfleiz...@apple.com
Date
2014-02-03 12:34:39 -0800 (Mon, 03 Feb 2014)

Log Message

AX: WebKit should support @headers/@id for complex accessible web tables
https://bugs.webkit.org/show_bug.cgi?id=128114

Reviewed by Darin Adler.

Source/WebCore: 

Expose the headers attribute for table cells to accessibility.

Test: platform/mac/accessibility/table-headers-attribute.html

* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::columnHeaders):

LayoutTests: 

* platform/mac/accessibility/table-headers-attribute-expected.txt: Added.
* platform/mac/accessibility/table-headers-attribute.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163319 => 163320)


--- trunk/LayoutTests/ChangeLog	2014-02-03 20:26:09 UTC (rev 163319)
+++ trunk/LayoutTests/ChangeLog	2014-02-03 20:34:39 UTC (rev 163320)
@@ -1,3 +1,13 @@
+2014-02-03  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: WebKit should support @headers/@id for complex accessible web tables
+        https://bugs.webkit.org/show_bug.cgi?id=128114
+
+        Reviewed by Darin Adler.
+
+        * platform/mac/accessibility/table-headers-attribute-expected.txt: Added.
+        * platform/mac/accessibility/table-headers-attribute.html: Added.
+
 2014-02-03  Jessie Berlin  <jber...@apple.com>
 
         Revert r163299 since it broke the ML 32-bit Release build

Added: trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute-expected.txt (0 => 163320)


--- trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute-expected.txt	2014-02-03 20:34:39 UTC (rev 163320)
@@ -0,0 +1,18 @@
+Course Name	Course Tutor	Summary	Code	Fee
+After the Civil War	Dr. John Wroughton	October	H27	£32	£32
+This tests that the headers attribute returns the correct headers for a table cell.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS colHeaders.length is 3
+PASS colHeaders[0].isEqual(table.cellForColumnAndRow(0, 0)) is true
+PASS colHeaders[1].isEqual(table.cellForColumnAndRow(2, 0)) is true
+PASS colHeaders[2].isEqual(table.cellForColumnAndRow(4, 0)) is true
+PASS colHeaders.length is 2
+PASS colHeaders[0].isEqual(table.cellForColumnAndRow(3, 0)) is true
+PASS colHeaders[1].isEqual(table.cellForColumnAndRow(2, 0)) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute.html (0 => 163320)


--- trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/table-headers-attribute.html	2014-02-03 20:34:39 UTC (rev 163320)
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<table border="1" cellpadding="5" cellspacing="2" id="table">
+  <tbody>
+  <tr>
+    <th id="header1" scope="col" abbr="Name">Course Name</th>
+    <th id="header2" scope="col" abbr="Tutor">Course Tutor</th>
+    <th id="header3" scope="col">Summary</th>
+    <th id="header4" scope="col">Code</th>
+    <th id="header5" scope="col" colspan="2">Fee</th>
+  </tr>
+  <tr>
+    <td id="cell1" headers="header1 header3 header5">After the Civil War</td>
+    <td id="cell2" headers="header4 header3 header6">Dr. John Wroughton</td>
+    <td>October</td>
+    <td>H27</td>
+    <td>£32</td>
+    <td>£32</td>
+  </tr>
+</tbody></table>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the headers attribute returns the correct headers for a table cell.");
+
+    if (window.accessibilityController) {
+
+        var table = accessibilityController.accessibleElementById("table");
+
+        // The first cell references header1 header3 header5.
+        var cell1 = table.cellForColumnAndRow(0, 1);
+        var colHeaders = cell1.columnHeaders();
+        shouldBe("colHeaders.length", "3");
+        shouldBeTrue("colHeaders[0].isEqual(table.cellForColumnAndRow(0, 0))");
+        shouldBeTrue("colHeaders[1].isEqual(table.cellForColumnAndRow(2, 0))");
+        shouldBeTrue("colHeaders[2].isEqual(table.cellForColumnAndRow(4, 0))");
+
+        // The second cell references header4 header3 and a non-existent header6.
+        var cell2 = table.cellForColumnAndRow(1, 1);
+        var colHeaders = cell2.columnHeaders();
+        shouldBe("colHeaders.length", "2");
+        shouldBeTrue("colHeaders[0].isEqual(table.cellForColumnAndRow(3, 0))");
+        shouldBeTrue("colHeaders[1].isEqual(table.cellForColumnAndRow(2, 0))");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (163319 => 163320)


--- trunk/Source/WebCore/ChangeLog	2014-02-03 20:26:09 UTC (rev 163319)
+++ trunk/Source/WebCore/ChangeLog	2014-02-03 20:34:39 UTC (rev 163320)
@@ -1,3 +1,17 @@
+2014-02-03  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: WebKit should support @headers/@id for complex accessible web tables
+        https://bugs.webkit.org/show_bug.cgi?id=128114
+
+        Reviewed by Darin Adler.
+
+        Expose the headers attribute for table cells to accessibility.
+
+        Test: platform/mac/accessibility/table-headers-attribute.html
+
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::columnHeaders):
+
 2014-02-03  Andreas Kling  <akl...@apple.com>
 
         CTTE: RenderSVGGradientStop always has a SVGStopElement.

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp (163319 => 163320)


--- trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2014-02-03 20:26:09 UTC (rev 163319)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableCell.cpp	2014-02-03 20:34:39 UTC (rev 163320)
@@ -148,6 +148,19 @@
     if (!parent)
         return;
 
+    // Choose columnHeaders as the place where the "headers" attribute is reported.
+    AXObjectCache* cache = axObjectCache();
+    Vector<Element*> elements;
+    elementsFromAttribute(elements, headersAttr);
+    for (auto& element : elements) {
+        if (AccessibilityObject* object = cache->getOrCreate(element))
+            headers.append(object);
+    }
+    
+    // If the headers attribute returned valid values, then do not further search for column headers.
+    if (!headers.isEmpty())
+        return;
+    
     std::pair<unsigned, unsigned> rowRange;
     rowIndexRange(rowRange);
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to