AX: VoiceOver in Safari does not read table header for first cell in first body row
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Nov 2017 23:44:16 +0000 (23:44 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Nov 2017 23:44:16 +0000 (23:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179780
<rdar://problem/35590551>

Reviewed by Joanmarie Diggs.

Source/WebCore:

A table cell shouldn't be considered a row header if it's in a row of other headers.

Test: accessibility/table-header-calculation-for-header-rows.html

* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::headerObject):

LayoutTests:

* accessibility/table-header-calculation-for-header-rows-expected.txt: Added.
* accessibility/table-header-calculation-for-header-rows.html: Added.
* accessibility/table-attributes-expected.txt: Updated.
* platform/gtk/accessibility/table-attributes-expected.txt: Updated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/table-attributes-expected.txt
LayoutTests/accessibility/table-header-calculation-for-header-rows-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/table-header-calculation-for-header-rows.html [new file with mode: 0644]
LayoutTests/platform/gtk/accessibility/table-attributes-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityTableRow.cpp

index 7e69e3d..66556be 100644 (file)
@@ -1,3 +1,16 @@
+2017-11-17  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: VoiceOver in Safari does not read table header for first cell in first body row
+        https://bugs.webkit.org/show_bug.cgi?id=179780
+        <rdar://problem/35590551>
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/table-header-calculation-for-header-rows-expected.txt: Added.
+        * accessibility/table-header-calculation-for-header-rows.html: Added.
+        * accessibility/table-attributes-expected.txt: Updated.
+        * platform/gtk/accessibility/table-attributes-expected.txt: Updated.
+
 2017-11-17  Nan Wang  <n_wang@apple.com>
 
         AX: AOM: Implement boolean type properties
index fecfcc5..b18685c 100644 (file)
@@ -200,80 +200,6 @@ AXRequired: 0
 AXRole: AXCell
 AXSubrole: (null)
 AXRoleDescription: cell
-AXChildren: <array of size 3>
-AXHelp: 
-AXParent: <AXCell>
-AXSize: NSSize: {145, 66}
-AXTitle: 
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXCell>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: <AXCell>
-AXEndTextMarker: <AXCell>
-AXVisited: 0
-AXLinkedUIElements: <array of size 0>
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXCell>
-AXLanguage: 
-AXDOMIdentifier: 
-AXDOMClassList: <array of size 1>
-AXFocusableAncestor: <AXCell>
-AXEditableAncestor: (null)
-AXHighestEditableAncestor: (null)
-AXRowIndexRange: NSRange: {0, 2}
-AXColumnIndexRange: NSRange: {0, 2}
-AXColumnHeaderUIElements: <array of size 0>
-AXRowHeaderUIElements: <array of size 0>
-AXARIAColumnIndex: -1
-AXARIARowIndex: -1
-AXElementBusy: 0
-AXRequired: 0
-
-------------
-AXRole: AXCell
-AXSubrole: (null)
-AXRoleDescription: cell
-AXChildren: <array of size 1>
-AXHelp: 
-AXParent: <AXCell>
-AXSize: NSSize: {54, 36}
-AXTitle: 
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXCell>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: <AXCell>
-AXEndTextMarker: <AXCell>
-AXVisited: 0
-AXLinkedUIElements: <array of size 0>
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXCell>
-AXLanguage: 
-AXDOMIdentifier: 
-AXDOMClassList: <array of size 1>
-AXFocusableAncestor: <AXCell>
-AXEditableAncestor: (null)
-AXHighestEditableAncestor: (null)
-AXRowIndexRange: NSRange: {1, 1}
-AXColumnIndexRange: NSRange: {3, 1}
-AXColumnHeaderUIElements: <array of size 1>
-AXRowHeaderUIElements: <array of size 1>
-AXARIAColumnIndex: -1
-AXARIARowIndex: -1
-AXElementBusy: 0
-AXRequired: 0
-
-------------
-AXRole: AXCell
-AXSubrole: (null)
-AXRoleDescription: cell
 AXChildren: <array of size 1>
 AXHelp: 
 AXParent: <AXCell>
diff --git a/LayoutTests/accessibility/table-header-calculation-for-header-rows-expected.txt b/LayoutTests/accessibility/table-header-calculation-for-header-rows-expected.txt
new file mode 100644 (file)
index 0000000..4098248
--- /dev/null
@@ -0,0 +1,11 @@
+This test makes sure cells are not marked as row headers when they're in a row of headers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS table1.rowHeaders().length is 0
+PASS table2.rowHeaders().length is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/table-header-calculation-for-header-rows.html b/LayoutTests/accessibility/table-header-calculation-for-header-rows.html
new file mode 100644 (file)
index 0000000..92c073f
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="content">
+<table border=1 id="table1">
+<tr><th>header 1</th><th>header 2</th><th>header 3</th></tr>
+<tr><td>cell 1</th><th>cell 2</th><th>cell 2</th></tr>
+</table>
+
+<table border=1 id="table2">
+<tr><th>header 1</th><td>header 2</th><td>header 3</th></tr>
+<tr><td>cell 1</th><th>cell 2</th><th>cell 2</th></tr>
+</table>
+
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test makes sure cells are not marked as row headers when they're in a row of headers.");
+
+    if (window.accessibilityController) {
+         var table1 = accessibilityController.accessibleElementById("table1");
+         shouldBe("table1.rowHeaders().length", "0");
+
+         var table2 = accessibilityController.accessibleElementById("table2");
+         shouldBe("table2.rowHeaders().length", "1");
+
+         document.getElementById("content").style.visibility = "hidden";
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index a20a9f1..cc747d5 100644 (file)
@@ -107,44 +107,6 @@ AXPlatformAttributes: computed-role:columnheader, tag:th, toolkit:WebKitGtk
 
 --------------------------
 
-AXRole: AXColumnHeader
-AXParent: AXRow
-AXChildren: 0
-AXPosition: { 227.000000, 27.000000 }
-AXSize: { 143.000000, 66.000000 }
-AXTitle: 
-AXDescription: 
-AXValue: Ruritanian<\n>Population <\n>Survey
-AXFocusable: 0
-AXFocused: 0
-AXSelectable: 0
-AXSelected: 0
-AXMultiSelectable: 0
-AXEnabled: 1
-AXExpanded: 0
-AXRequired: 0
-AXChecked: 0
-AXPlatformAttributes: computed-role:columnheader, tag:th, toolkit:WebKitGtk
-------------
-AXRole: AXColumnHeader
-AXParent: AXRow
-AXChildren: 0
-AXPosition: { 227.000000, 27.000000 }
-AXSize: { 143.000000, 66.000000 }
-AXTitle: 
-AXDescription: 
-AXValue: Ruritanian<\n>Population <\n>Survey
-AXFocusable: 0
-AXFocused: 0
-AXSelectable: 0
-AXSelected: 0
-AXMultiSelectable: 0
-AXEnabled: 1
-AXExpanded: 0
-AXRequired: 0
-AXChecked: 0
-AXPlatformAttributes: computed-role:columnheader, tag:th, toolkit:WebKitGtk
-------------
 AXRole: AXRowHeader
 AXParent: AXRow
 AXChildren: 0
index 1b07fc2..8673a23 100644 (file)
@@ -1,3 +1,18 @@
+2017-11-17  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: VoiceOver in Safari does not read table header for first cell in first body row
+        https://bugs.webkit.org/show_bug.cgi?id=179780
+        <rdar://problem/35590551>
+
+        Reviewed by Joanmarie Diggs.
+
+        A table cell shouldn't be considered a row header if it's in a row of other headers.
+
+        Test: accessibility/table-header-calculation-for-header-rows.html
+
+        * accessibility/AccessibilityTableRow.cpp:
+        (WebCore::AccessibilityTableRow::headerObject):
+
 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
 
         Don't invert a matrix for every channel of every pixel of an FETurbulence filter
index d27db2c..d21f903 100644 (file)
@@ -132,6 +132,18 @@ AccessibilityObject* AccessibilityTableRow::headerObject()
     if (!cellNode || !cellNode->hasTagName(thTag))
         return nullptr;
     
+    // Verify that the row header is not part of an entire row of headers.
+    // In that case, it is unlikely this is a row header.
+    bool allHeadersInRow = true;
+    for (auto cell : rowChildren) {
+        if (cell->node() && !cell->node()->hasTagName(thTag)) {
+            allHeadersInRow = false;
+            break;
+        }
+    }
+    if (allHeadersInRow)
+        return nullptr;
+    
     return cell;
 }