Title: [160789] trunk
Revision
160789
Author
[email protected]
Date
2013-12-18 12:40:26 -0800 (Wed, 18 Dec 2013)

Log Message

AX: make aria-hidden=false work with subtrees
https://bugs.webkit.org/show_bug.cgi?id=125592

Reviewed by Mario Sanchez Prada.

Source/WebCore: 

When a hidden object uses aria-hidden=false, that needs to apply to
the entire sub-tree (not just the object with aria-hidden on it as it does now).

Enabling this had the side effect of exposing non-rendered text nodes, so there's
some extra checks to ensure we don't include those elements in this cases.

Test: accessibility/aria-hidden-false-works-in-subtrees.html

* accessibility/AXObjectCache.cpp:
(WebCore::isNodeAriaVisible):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::computeAccessibilityIsIgnored):

LayoutTests: 

* platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt: Added.
* accessibility/aria-hidden-false-works-in-subtrees.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160788 => 160789)


--- trunk/LayoutTests/ChangeLog	2013-12-18 20:37:31 UTC (rev 160788)
+++ trunk/LayoutTests/ChangeLog	2013-12-18 20:40:26 UTC (rev 160789)
@@ -1,3 +1,13 @@
+2013-12-18  Chris Fleizach  <[email protected]>
+
+        AX: make aria-hidden=false work with subtrees
+        https://bugs.webkit.org/show_bug.cgi?id=125592
+
+        Reviewed by Mario Sanchez Prada.
+
+        * platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt: Added.
+        * accessibility/aria-hidden-false-works-in-subtrees.html: Added.
+
 2013-12-18  Alexey Proskuryakov  <[email protected]>
 
         Flaky Test: media/video-buffered.html

Added: trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html (0 => 160789)


--- trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html	2013-12-18 20:40:26 UTC (rev 160789)
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div hidden aria-hidden="false" aria-label="group0">
+   <div aria-hidden="true" aria-label="group1">
+      ignore me
+   </div>
+   <div role="group" aria-label="group2">
+     <div role="button" aria-label="button1">button</div>
+     don't ignore me
+  </div>
+</div>
+
+<div id="iframe">
+<iframe _onload_="testiFrameContent();" aria-hidden="false" src="" content</iframe>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that a sub-tree within a node marked with aria-hidden=false will be exposed in the AX tree.");
+
+    var iframeChild;
+    function testiFrameContent() {
+        // Test that aria-hidden=false does NOT expose iframe fallback text.
+        var iframe = accessibilityController.accessibleElementById("iframe").childAtIndex(0).childAtIndex(0);
+
+        debug("Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.");
+        iframeChild = iframe.childAtIndex(0);
+        debug("iFrame child role: " + iframeChild.role);
+
+        finishJSTest();
+    }
+
+    function dumpAccessibilityChildren(element, level) {
+        if (!element) {
+            return;
+        }
+        var indent = "";
+        for (var k = 0; k < level; k++) { indent += "  "; }
+        debug(indent + element.role + "\n" + indent + element.description + "\n");
+        var childrenCount = element.childrenCount;
+        for (var k = 0; k < childrenCount; k++) {
+            dumpAccessibilityChildren(element.childAtIndex(k), level+1);
+        }
+    }
+ 
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+        dumpAccessibilityChildren(root, 0);
+}
+
+</script>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt (0 => 160789)


--- trunk/LayoutTests/platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-hidden-false-works-in-subtrees-expected.txt	2013-12-18 20:40:26 UTC (rev 160789)
@@ -0,0 +1,24 @@
+
+This tests that a sub-tree within a node marked with aria-hidden=false will be exposed in the AX tree.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXRole: AXGroup
+AXDescription: group0
+
+  AXRole: AXGroup
+  AXDescription: group2
+
+    AXRole: AXButton
+    AXDescription: button1
+
+    AXRole: AXStaticText
+    AXDescription: 
+
+Non-rendered iframe content should not be visible when aria-hidden=true. The first child should be a group and NOT static text.
+iFrame child role: AXRole: AXGroup
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (160788 => 160789)


--- trunk/Source/WebCore/ChangeLog	2013-12-18 20:37:31 UTC (rev 160788)
+++ trunk/Source/WebCore/ChangeLog	2013-12-18 20:40:26 UTC (rev 160789)
@@ -1,3 +1,23 @@
+2013-12-18  Chris Fleizach  <[email protected]>
+
+        AX: make aria-hidden=false work with subtrees
+        https://bugs.webkit.org/show_bug.cgi?id=125592
+
+        Reviewed by Mario Sanchez Prada.
+
+        When a hidden object uses aria-hidden=false, that needs to apply to
+        the entire sub-tree (not just the object with aria-hidden on it as it does now).
+
+        Enabling this had the side effect of exposing non-rendered text nodes, so there's
+        some extra checks to ensure we don't include those elements in this cases.
+
+        Test: accessibility/aria-hidden-false-works-in-subtrees.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::isNodeAriaVisible):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::computeAccessibilityIsIgnored):
+
 2013-12-18  Oliver Hunt  <[email protected]>
 
         Simplify bindings codegen for adding getOwnPropertySlot overrides

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (160788 => 160789)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-12-18 20:37:31 UTC (rev 160788)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2013-12-18 20:40:26 UTC (rev 160789)
@@ -977,10 +977,19 @@
     if (!node)
         return false;
     
-    if (!node->isElementNode())
-        return false;
+    // To determine if a node is ARIA visible, we need to check the parent hierarchy to see if anyone specifies
+    // aria-hidden explicitly.
+    for (Node* testNode = node; testNode; testNode = testNode->parentNode()) {
+        if (testNode->isElementNode()) {
+            const AtomicString& ariaHiddenValue = toElement(testNode)->fastGetAttribute(aria_hiddenAttr);
+            if (equalIgnoringCase(ariaHiddenValue, "false"))
+                return true;
+            if (equalIgnoringCase(ariaHiddenValue, "true"))
+                return false;
+        }
+    }
     
-    return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "false");
+    return false;
 }
 
 AXAttributeCacheEnabler::AXAttributeCacheEnabler(AXObjectCache* cache)

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (160788 => 160789)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-12-18 20:37:31 UTC (rev 160788)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2013-12-18 20:40:26 UTC (rev 160789)
@@ -411,6 +411,18 @@
     ASSERT(m_initialized);
 #endif
 
+    // Handle non-rendered text that is exposed through aria-hidden=false.
+    if (m_node && m_node->isTextNode() && !renderer()) {
+        // Fallback content in iframe nodes should be ignored.
+        if (m_node->parentNode() && m_node->parentNode()->hasTagName(iframeTag) && m_node->parentNode()->renderer())
+            return true;
+
+        // Whitespace only text elements should be ignored when they have no renderer.
+        String string = stringValue().stripWhiteSpace().simplifyWhiteSpace();
+        if (!string.length())
+            return true;
+    }
+    
     // If this element is within a parent that cannot have children, it should not be exposed.
     if (isDescendantOfBarrenParent())
         return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to