Title: [198819] trunk
Revision
198819
Author
n_w...@apple.com
Date
2016-03-29 19:02:47 -0700 (Tue, 29 Mar 2016)

Log Message

AX: VoiceOver not announcing the right header information for table on iOS
https://bugs.webkit.org/show_bug.cgi?id=155907

Reviewed by Chris Fleizach.

Source/WebCore:

Make sure we consider the case where header elements size does not equal to
row size.

Test: accessibility/ios-simulator/table-row-column-headers.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityHeaderElements]):

LayoutTests:

* accessibility/ios-simulator/table-row-column-headers-expected.txt: Added.
* accessibility/ios-simulator/table-row-column-headers.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198818 => 198819)


--- trunk/LayoutTests/ChangeLog	2016-03-30 01:31:33 UTC (rev 198818)
+++ trunk/LayoutTests/ChangeLog	2016-03-30 02:02:47 UTC (rev 198819)
@@ -1,3 +1,13 @@
+2016-03-29  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver not announcing the right header information for table on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=155907
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/table-row-column-headers-expected.txt: Added.
+        * accessibility/ios-simulator/table-row-column-headers.html: Added.
+
 2016-03-29  Dana Burkart and Matthew Hanson  <dburk...@apple.com>
 
         Web Inspector: JS PrettyPrinting in do/while loops, "while" should be on the same line as "}" if there was a closing brace

Added: trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers-expected.txt (0 => 198819)


--- trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers-expected.txt	2016-03-30 02:02:47 UTC (rev 198819)
@@ -0,0 +1,33 @@
+ColHeader1	ColHeader2
+Rowheader1	content1	content2	content3
+RowHeader2	content4	content5	content6
+content7	content8	content9
+This test makes sure that cells are getting the correct header elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Verifying "content1" with col header: "ColHeader1" row header: "Rowheader1".
+PASS cell.headerElementAtIndex(0).description is colDescription
+PASS cell.headerElementAtIndex(1).description is rowDescription
+
+
+Verifying "content2" with col header: "ColHeader2" row header: "Rowheader1".
+PASS cell.headerElementAtIndex(0).description is colDescription
+PASS cell.headerElementAtIndex(1).description is rowDescription
+
+
+Verifying "content7" with col header: "ColHeader1" row header: "Rowheader2".
+PASS cell.headerElementAtIndex(0).description is colDescription
+PASS cell.headerElementAtIndex(1).description is rowDescription
+
+
+Verifying "content9" with col header: "ColHeader2" row header: "Rowheader2".
+PASS cell.headerElementAtIndex(0).description is colDescription
+PASS cell.headerElementAtIndex(1).description is rowDescription
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers.html (0 => 198819)


--- trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/table-row-column-headers.html	2016-03-30 02:02:47 UTC (rev 198819)
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+var successfullyParsed = false;
+</script>
+<style>
+table, th, td {
+    border: 1px solid black;
+}
+</style>
+</head>
+<body>
+
+<table>
+<thead><tr>
+<td></td>
+<th aria-label="ColHeader1">ColHeader1</th>
+<th aria-label="ColHeader2" colspan="2">ColHeader2</th>
+</tr></thead>
+
+<tbody>
+<tr>
+<th aria-label="Rowheader1">Rowheader1</th>
+<td id="content1">content1</td>
+<td id="content2">content2</td>
+<td>content3</td>
+</tr>
+<tr>
+<th aria-label="Rowheader2" rowspan="2">RowHeader2</th>
+<td>content4</td>
+<td>content5</td>
+<td>content6</td>
+</tr>
+<tr>
+<td id="content7">content7</td>
+<td>content8</td>
+<td id="content9">content9</td>
+</tr>
+</tbody>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test makes sure that cells are getting the correct header elements.");
+    
+    if (window.accessibilityController) {
+        
+        var cell;
+        var colDescription, rowDescription;
+        var rowHeaderLabel1 = "Rowheader1";
+        var rowHeaderLabel2 = "Rowheader2";
+        var colHeaderLabel1 = "ColHeader1";
+        var colHeaderLabel2 = "ColHeader2";
+        
+        verifyCellAndHeaders("content1", colHeaderLabel1, rowHeaderLabel1);
+        verifyCellAndHeaders("content2", colHeaderLabel2, rowHeaderLabel1);
+        verifyCellAndHeaders("content7", colHeaderLabel1, rowHeaderLabel2);
+        verifyCellAndHeaders("content9", colHeaderLabel2, rowHeaderLabel2);
+    }
+    
+    function verifyCellAndHeaders(cellID, colHeader, rowHeader) {
+        cell = accessibilityController.accessibleElementById(cellID);
+        colDescription = "AXLabel: " + colHeader;
+        rowDescription = "AXLabel: " + rowHeader;
+        debug("Verifying \"" + cellID + "\" with col header: \"" + colHeader + "\" row header: \"" + rowHeader + "\".");
+        shouldBe("cell.headerElementAtIndex(0).description", "colDescription");
+        shouldBe("cell.headerElementAtIndex(1).description", "rowDescription");
+        debug("\n");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (198818 => 198819)


--- trunk/Source/WebCore/ChangeLog	2016-03-30 01:31:33 UTC (rev 198818)
+++ trunk/Source/WebCore/ChangeLog	2016-03-30 02:02:47 UTC (rev 198819)
@@ -1,3 +1,18 @@
+2016-03-29  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver not announcing the right header information for table on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=155907
+
+        Reviewed by Chris Fleizach.
+
+        Make sure we consider the case where header elements size does not equal to
+        row size.
+
+        Test: accessibility/ios-simulator/table-row-column-headers.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityHeaderElements]):
+
 2016-03-29  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         REGRESSION (r198782): CGImageSourceUpdateData() is called twice with the same data every time ImageSource::setData() is called

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (198818 => 198819)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2016-03-30 01:31:33 UTC (rev 198818)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2016-03-30 02:02:47 UTC (rev 198819)
@@ -1057,13 +1057,20 @@
     }
 
     unsigned rowRangeIndex = static_cast<unsigned>(rowRange.first);
-    if (rowRangeIndex < rowHeaders.size()) {
-        RefPtr<AccessibilityObject> rowHeader = rowHeaders[rowRange.first];
-        AccessibilityObjectWrapper* wrapper = rowHeader->wrapper();
-        if (wrapper)
-            [headers addObject:wrapper];
+    // We should consider the cases where the row number does NOT match the index in
+    // rowHeaders, the most common case is when row0/col0 does not have a header.
+    for (const auto& rowHeader : rowHeaders) {
+        if (!is<AccessibilityTableCell>(*rowHeader))
+            break;
+        std::pair<unsigned, unsigned> rowHeaderRange;
+        downcast<AccessibilityTableCell>(*rowHeader).rowIndexRange(rowHeaderRange);
+        if (rowRangeIndex >= rowHeaderRange.first && rowRangeIndex < rowHeaderRange.first + rowHeaderRange.second) {
+            if (AccessibilityObjectWrapper* wrapper = rowHeader->wrapper())
+                [headers addObject:wrapper];
+            break;
+        }
     }
-        
+
     return headers;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to