Source/WebCore: VoiceOver cannot navigate the iTunes album view table
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jun 2011 18:20:28 +0000 (18:20 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jun 2011 18:20:28 +0000 (18:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=62335

Reviewed by David Kilzer.

This is a regression from https://bugs.webkit.org/show_bug.cgi?id=57463.
Part of that patch made a change so that an ARIA table will only look at it's children and grandchildren
for possible rows. That however, doesn't allow arbitrary hierarchies to work with ARIA, like in iTunes album view.

Test: platform/mac/accessibility/aria-grid-with-strange-hierarchy.html

* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::addChild):
(WebCore::AccessibilityARIAGrid::addChildren):
* accessibility/AccessibilityARIAGrid.h:

LayoutTests: VoiceOver cannot navigate the itunes album view table
https://bugs.webkit.org/show_bug.cgi?id=62335

Reviewed by David Kilzer.

* platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt: Added.
* platform/mac/accessibility/aria-grid-with-strange-hierarchy.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
Source/WebCore/accessibility/AccessibilityARIAGrid.h

index 5ba710e..90240ec 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-14  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by David Kilzer.
+
+        VoiceOver cannot navigate the itunes album view table
+        https://bugs.webkit.org/show_bug.cgi?id=62335
+
+        * platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt: Added.
+        * platform/mac/accessibility/aria-grid-with-strange-hierarchy.html: Added.
+
 2011-06-13  Adrienne Walker  <enne@google.com>
 
         Reviewed by James Robinson.
diff --git a/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt b/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt
new file mode 100644 (file)
index 0000000..49d9d84
--- /dev/null
@@ -0,0 +1,19 @@
+      Name    Time    Popularity       Price
+1      Test    Test    Test
+This tests that an ARIA grid with a hierarchy that ignores render elements in between will still expose the correct elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS grid.childrenCount is 6
+PASS grid.childAtIndex(0).role is 'AXRole: AXRow'
+PASS grid.childAtIndex(1).role is 'AXRole: AXColumn'
+PASS grid.childAtIndex(0).childrenCount is 4
+PASS grid.childAtIndex(0).childAtIndex(0).role is 'AXRole: AXCell'
+PASS grid.childAtIndex(0).childAtIndex(0).role is 'AXRole: AXCell'
+PASS grid.childAtIndex(0).childAtIndex(0).childAtIndex(0).role is 'AXRole: AXStaticText'
+PASS grid.childAtIndex(0).childAtIndex(0).childAtIndex(0).stringValue is 'AXValue: 1'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy.html b/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy.html
new file mode 100644 (file)
index 0000000..326869a
--- /dev/null
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div tabindex=0 id="grid" role="grid" aria-readonly="true">
+<div  role="presentation">
+  <table role="presentation">
+          <thead>
+            <tr>
+                 <th role="columnheader" aria-sort="ascending">&nbsp;</th>
+                 <th role="columnheader">Name</th>
+                 <th role="columnheader">Time</th>
+                 <th role="columnheader">Popularity</th>
+                 <th role="columnheader"> Price</th>
+            </tr>
+          </thead>
+     
+    <tbody>
+    <tr role="row">
+        <td role="gridcell">
+          <span class="index"><span>1</span></span>
+        </td>
+        <td role="gridcell"">
+          <span><span>Test</span></span>
+        </td>
+        <td role="gridcell"">
+          <span><span>Test</span></span>
+        </td>
+        <td role="gridcell"">
+          <span><span>Test</span></span>
+        </td>
+    </tr>   
+</table></div></div>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that an ARIA grid with a hierarchy that ignores render elements in between will still expose the correct elements.");
+
+    if (window.accessibilityController) {
+
+          // this text field should be required.
+          document.getElementById("grid").focus();
+          var grid = accessibilityController.focusedElement;
+
+          shouldBe("grid.childrenCount", "6");
+          shouldBe("grid.childAtIndex(0).role", "'AXRole: AXRow'");
+          shouldBe("grid.childAtIndex(1).role", "'AXRole: AXColumn'");
+
+          shouldBe("grid.childAtIndex(0).childrenCount", "4");
+          shouldBe("grid.childAtIndex(0).childAtIndex(0).role", "'AXRole: AXCell'");
+
+          shouldBe("grid.childAtIndex(0).childAtIndex(0).role", "'AXRole: AXCell'");
+          shouldBe("grid.childAtIndex(0).childAtIndex(0).childAtIndex(0).role", "'AXRole: AXStaticText'");
+          shouldBe("grid.childAtIndex(0).childAtIndex(0).childAtIndex(0).stringValue", "'AXValue: 1'");
+
+    }
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 4031a95..8850f5f 100644 (file)
@@ -1,3 +1,21 @@
+2011-06-14  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by David Kilzer.
+
+        VoiceOver cannot navigate the iTunes album view table
+        https://bugs.webkit.org/show_bug.cgi?id=62335
+
+        This is a regression from https://bugs.webkit.org/show_bug.cgi?id=57463.
+        Part of that patch made a change so that an ARIA table will only look at it's children and grandchildren
+        for possible rows. That however, doesn't allow arbitrary hierarchies to work with ARIA, like in iTunes album view.
+
+        Test: platform/mac/accessibility/aria-grid-with-strange-hierarchy.html
+
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::addChild):
+        (WebCore::AccessibilityARIAGrid::addChildren):
+        * accessibility/AccessibilityARIAGrid.h:
+
 2011-06-14  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r88823.
index 5f9444a..645b4cc 100644 (file)
@@ -59,14 +59,14 @@ PassRefPtr<AccessibilityARIAGrid> AccessibilityARIAGrid::create(RenderObject* re
     return adoptRef(new AccessibilityARIAGrid(renderer));
 }
 
-void AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
+bool AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
 {
     if (!child || !child->isTableRow() || child->ariaRoleAttribute() != RowRole)
-        return;
+        return false;
         
     AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(child);
     if (appendedRows.contains(row))
-        return;
+        return false;
         
     // store the maximum number of columns
     unsigned rowCellCount = row->children().size();
@@ -84,6 +84,7 @@ void AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<Accessi
         m_children.append(row->children());
 
     appendedRows.add(row);
+    return true;
 }
     
 void AccessibilityARIAGrid::addChildren()
@@ -106,20 +107,18 @@ void AccessibilityARIAGrid::addChildren()
     unsigned columnCount = 0;
     for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {
 
-        if (child->isTableRow() || child->ariaRoleAttribute() == RowRole)
-            addChild(child.get(), appendedRows, columnCount);
-        else {
+        if (!addChild(child.get(), appendedRows, columnCount)) {
+            
             // in case the render tree doesn't match the expected ARIA hierarchy, look at the children
             if (!child->hasChildren())
                 child->addChildren();
 
-            // Do not navigate children through the Accessibility
-            // children vector to let addChild() check the result
-            // of accessibilityIsIgnored() and make the proper
-            // decision (add the objects or their children).
-            AccessibilityObject* grandChild = 0;
-            for (grandChild = child->firstChild(); grandChild; grandChild = grandChild->nextSibling())
-                addChild(grandChild, appendedRows, columnCount);
+            // The children of this non-row will contain all non-ignored elements (recursing to find them). 
+            // This allows the table to dive arbitrarily deep to find the rows.
+            AccessibilityChildrenVector children = child->children();
+            size_t length = children.size();
+            for (size_t i = 0; i < length; ++i)
+                addChild(children[i].get(), appendedRows, columnCount);
         }
     }
     
index 02ff4d0..edc26d9 100644 (file)
@@ -55,7 +55,7 @@ private:
     // ARIA treegrids and grids support selected rows.
     virtual bool supportsSelectedRows() { return true; }    
 
-    void addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
+    bool addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
 };
 
 } // namespace WebCore