Title: [139456] trunk
Revision
139456
Author
dmazz...@google.com
Date
2013-01-11 10:06:57 -0800 (Fri, 11 Jan 2013)

Log Message

AX: Computed hierarchical level is not consistent with aria-level
https://bugs.webkit.org/show_bug.cgi?id=106638

Reviewed by Chris Fleizach.

Source/WebCore:

Make hierarchicalLevel computation 1-based to match the aria-level spec.

Extends an existing test: platform/mac/accessibility/aria-tree.html.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::hierarchicalLevel):
* accessibility/AccessibilityObject.h:
(AccessibilityObject):
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

Extend aria-tree.html to check the hierarchicalLevel automatically
computed when aria-level is not provided. Make sure they're consistent.
Now, the mac disclosureLevel will be one less than the web aria-level.

* platform/mac/accessibility/aria-tree-expected.txt:
* platform/mac/accessibility/aria-tree.html:
* platform/mac/accessibility/aria-treegrid-expected.txt:
* platform/mac/accessibility/aria-treegrid.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139455 => 139456)


--- trunk/LayoutTests/ChangeLog	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/LayoutTests/ChangeLog	2013-01-11 18:06:57 UTC (rev 139456)
@@ -1,3 +1,19 @@
+2013-01-11  Dominic Mazzoni  <dmazz...@google.com>
+
+        AX: Computed hierarchical level is not consistent with aria-level
+        https://bugs.webkit.org/show_bug.cgi?id=106638
+
+        Reviewed by Chris Fleizach.
+
+        Extend aria-tree.html to check the hierarchicalLevel automatically
+        computed when aria-level is not provided. Make sure they're consistent.
+        Now, the mac disclosureLevel will be one less than the web aria-level.
+
+        * platform/mac/accessibility/aria-tree-expected.txt:
+        * platform/mac/accessibility/aria-tree.html:
+        * platform/mac/accessibility/aria-treegrid-expected.txt:
+        * platform/mac/accessibility/aria-treegrid.html:
+
 2013-01-11  Stephen Chenney  <schen...@chromium.org>
 
         [Chromium] Test Expectations update after Skia flag changes.

Modified: trunk/LayoutTests/platform/mac/accessibility/aria-tree-expected.txt (139455 => 139456)


--- trunk/LayoutTests/platform/mac/accessibility/aria-tree-expected.txt	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-tree-expected.txt	2013-01-11 18:06:57 UTC (rev 139456)
@@ -3,6 +3,9 @@
 Cats
 Siamese
 Tabby
+Vegetables
+Carrots
+Broccoli
 This tests that aria trees and tree items are converted into AXOutlines and AXRows, with all the right attributes.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -10,16 +13,16 @@
 
 PASS tree.role is 'AXRole: AXOutline'
 PASS canSetRows is true
-PASS tree.childrenCount is 5
+PASS tree.childrenCount is 8
 PASS treeitem1.role is 'AXRole: AXRow'
 PASS treeitem1.subrole is 'AXSubrole: AXOutlineRow'
 PASS treeitem1.isExpanded is true
-PASS treeitem1.hierarchicalLevel is 1
+PASS treeitem1.hierarchicalLevel is 0
 PASS canSetDisclosing is true
 PASS treeitem2.role is 'AXRole: AXRow'
 PASS treeitem2.subrole is 'AXSubrole: AXOutlineRow'
 PASS treeitem2.isExpanded is false
-PASS treeitem2.hierarchicalLevel is 2
+PASS treeitem2.hierarchicalLevel is 1
 PASS treeitem2.disclosedByRow().isEqual(treeitem1) is true
 PASS canSetDisclosing is false
 PASS treeitem3.stringValue is 'AXValue: Birds'
@@ -30,6 +33,9 @@
 PASS treeitem3.isSelected is false
 PASS treeitem3.isSelected is true
 PASS selectedRow.isEqual(treeitem3) is true
+PASS treeitem4.hierarchicalLevel is 0
+PASS treeitem5.hierarchicalLevel is 1
+PASS treeitem6.hierarchicalLevel is 1
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/accessibility/aria-tree.html (139455 => 139456)


--- trunk/LayoutTests/platform/mac/accessibility/aria-tree.html	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-tree.html	2013-01-11 18:06:57 UTC (rev 139456)
@@ -26,6 +26,18 @@
             </ul>
         </span>
     </li>
+
+    <li id="treeitem4" role="treeitem" aria-expanded="true">
+        <span>
+            <span class="expander"></span>
+            Vegetables
+            </span>
+            <ul role="group">
+                <div id="treeitem5" role="treeitem"><span>Carrots</span></div>
+                <div id="treeitem6" role="treeitem"><span>Broccoli</span></div>
+            </ul>
+        </span>
+    </li>
 </ul>
 
 <p id="description"></p>
@@ -45,14 +57,14 @@
           shouldBe("tree.role", "'AXRole: AXOutline'");
           var canSetRows = tree.isAttributeSettable('AXSelectedRows');
           shouldBe("canSetRows", "true");
-          shouldBe("tree.childrenCount", "5");
+          shouldBe("tree.childrenCount", "8");
       
           // Test tree item attributes.
           var treeitem1 = tree.childAtIndex(0);
           shouldBe("treeitem1.role", "'AXRole: AXRow'");
           shouldBe("treeitem1.subrole", "'AXSubrole: AXOutlineRow'");
           shouldBe("treeitem1.isExpanded", "true");
-          shouldBe("treeitem1.hierarchicalLevel", "1");
+          shouldBe("treeitem1.hierarchicalLevel", "0");
           var canSetDisclosing = treeitem1.isAttributeSettable('AXDisclosing');
           shouldBe("canSetDisclosing", "true");
           
@@ -61,7 +73,7 @@
           shouldBe("treeitem2.role", "'AXRole: AXRow'");
           shouldBe("treeitem2.subrole", "'AXSubrole: AXOutlineRow'");
           shouldBe("treeitem2.isExpanded", "false");
-          shouldBe("treeitem2.hierarchicalLevel", "2");
+          shouldBe("treeitem2.hierarchicalLevel", "1");
           shouldBe("treeitem2.disclosedByRow().isEqual(treeitem1)", "true");
           canSetDisclosing = treeitem2.isAttributeSettable('AXDisclosing');
           shouldBe("canSetDisclosing", "false");
@@ -85,6 +97,17 @@
           // Test that the tree reports the right selected row (treeitem3)
           var selectedRow = tree.selectedRowAtIndex(0);
           shouldBe("selectedRow.isEqual(treeitem3)", "true");          
+
+          // Test that hierarchicalLevel can be computed automatically, also,
+          // and that it's consistent with the ARIA level.
+          var treeitem4 = accessibilityController.accessibleElementById("treeitem4");
+          shouldBe("treeitem4.hierarchicalLevel", "0");
+
+          var treeitem5 = accessibilityController.accessibleElementById("treeitem5");
+          shouldBe("treeitem5.hierarchicalLevel", "1");
+
+          var treeitem6 = accessibilityController.accessibleElementById("treeitem6");
+          shouldBe("treeitem6.hierarchicalLevel", "1");
     }
 
 </script>

Modified: trunk/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt (139455 => 139456)


--- trunk/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt	2013-01-11 18:06:57 UTC (rev 139456)
@@ -10,11 +10,11 @@
 PASS treegrid.isAttributeSupported('AXSelectedRows') is true
 PASS treegrid.selectedRowAtIndex(0).isEqual(selectedRow) is true
 PASS selectedRow.isExpanded is false
-PASS selectedRow.hierarchicalLevel is 1
+PASS selectedRow.hierarchicalLevel is 0
 PASS secondRow.isExpanded is true
-PASS secondRow.hierarchicalLevel is 1
+PASS secondRow.hierarchicalLevel is 0
 PASS thirdRow.isExpanded is true
-PASS thirdRow.hierarchicalLevel is 2
+PASS thirdRow.hierarchicalLevel is 1
 PASS thirdRow.disclosedByRow().isEqual(secondRow) is true
 PASS secondRow.disclosedRowAtIndex(0).isEqual(thirdRow) is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/platform/mac/accessibility/aria-treegrid.html (139455 => 139456)


--- trunk/LayoutTests/platform/mac/accessibility/aria-treegrid.html	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-treegrid.html	2013-01-11 18:06:57 UTC (rev 139456)
@@ -39,15 +39,15 @@
           shouldBe("treegrid.isAttributeSupported('AXSelectedRows')", "true");
           shouldBe("treegrid.selectedRowAtIndex(0).isEqual(selectedRow)", "true");
           shouldBe("selectedRow.isExpanded", "false");
-          shouldBe("selectedRow.hierarchicalLevel", "1");
+          shouldBe("selectedRow.hierarchicalLevel", "0");
 
           var secondRow = treegrid.childAtIndex(1);
           shouldBe("secondRow.isExpanded", "true");
-          shouldBe("secondRow.hierarchicalLevel", "1");
+          shouldBe("secondRow.hierarchicalLevel", "0");
 
           var thirdRow = treegrid.childAtIndex(2);
           shouldBe("thirdRow.isExpanded", "true");
-          shouldBe("thirdRow.hierarchicalLevel", "2");
+          shouldBe("thirdRow.hierarchicalLevel", "1");
 
           // Make sure that the row disclosure works correctly.
           shouldBe("thirdRow.disclosedByRow().isEqual(secondRow)", "true");

Modified: trunk/Source/WebCore/ChangeLog (139455 => 139456)


--- trunk/Source/WebCore/ChangeLog	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/Source/WebCore/ChangeLog	2013-01-11 18:06:57 UTC (rev 139456)
@@ -1,3 +1,21 @@
+2013-01-11  Dominic Mazzoni  <dmazz...@google.com>
+
+        AX: Computed hierarchical level is not consistent with aria-level
+        https://bugs.webkit.org/show_bug.cgi?id=106638
+
+        Reviewed by Chris Fleizach.
+
+        Make hierarchicalLevel computation 1-based to match the aria-level spec.
+
+        Extends an existing test: platform/mac/accessibility/aria-tree.html.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::hierarchicalLevel):
+        * accessibility/AccessibilityObject.h:
+        (AccessibilityObject):
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
 2013-01-11  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Workspace should support several projects and should not have temporary UISourceCodes.

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (139455 => 139456)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-01-11 18:06:57 UTC (rev 139456)
@@ -1418,9 +1418,9 @@
     if (roleValue() != TreeItemRole)
         return 0;
     
-    // Hierarchy leveling starts at 0.
+    // Hierarchy leveling starts at 1, to match the aria-level spec.
     // We measure tree hierarchy by the number of groups that the item is within.
-    unsigned level = 0;
+    unsigned level = 1;
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         AccessibilityRole parentRole = parent->roleValue();
         if (parentRole == GroupRole)

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (139455 => 139456)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2013-01-11 18:06:57 UTC (rev 139456)
@@ -596,6 +596,7 @@
     virtual FrameView* topDocumentFrameView() const { return 0; }
     virtual FrameView* documentFrameView() const;
     String language() const;
+    // 1-based, to match the aria-level spec.
     virtual unsigned hierarchicalLevel() const { return 0; }
     
     virtual void setFocused(bool) { }

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (139455 => 139456)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2013-01-11 17:48:09 UTC (rev 139455)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2013-01-11 18:06:57 UTC (rev 139456)
@@ -2481,8 +2481,13 @@
         }
     }
 
-    if ([attributeName isEqualToString:NSAccessibilityDisclosureLevelAttribute])
-        return [NSNumber numberWithInt:m_object->hierarchicalLevel()];
+    if ([attributeName isEqualToString:NSAccessibilityDisclosureLevelAttribute]) {
+        // Convert from 1-based level (from aria-level spec) to 0-based level (Mac)
+        int level = m_object->hierarchicalLevel();
+        if (level > 0)
+            level -= 1;
+        return [NSNumber numberWithInt:level];
+    }
     if ([attributeName isEqualToString:NSAccessibilityDisclosingAttribute])
         return [NSNumber numberWithBool:m_object->isExpanded()];
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to