<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184890] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184890">184890</a></dd>
<dt>Author</dt> <dd>cfleizach@apple.com</dd>
<dt>Date</dt> <dd>2015-05-26 17:53:00 -0700 (Tue, 26 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
https://bugs.webkit.org/show_bug.cgi?id=139142

Reviewed by Darin Adler.
Source/WebCore:

     
Amend the code that determines when an invisible, but aria-hidden=false, element is exposed to accessibility.

The new guideline is that you must have aria-hidden=false on every node that is not rendered (except text which inherits)
otherwise the element will not be visible.

Modified existing test: accessibility/aria-hidden-false-works-in-subtrees.html

* accessibility/AXObjectCache.cpp:
(WebCore::isNodeAriaVisible):
(WebCore::AXObjectCache::rootWebArea):

LayoutTests:


* accessibility/aria-hidden-false-works-in-subtrees.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityariahiddenfalseworksinsubtreeshtml">trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (184889 => 184890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/LayoutTests/ChangeLog        2015-05-27 00:53:00 UTC (rev 184890)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-05-26  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
+        https://bugs.webkit.org/show_bug.cgi?id=139142
+
+        Reviewed by Darin Adler.
+
+        * accessibility/aria-hidden-false-works-in-subtrees.html:
+
</ins><span class="cx"> 2015-05-26  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Overhanging float sets are not cleaned up properly when floating renderer is destroyed.
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityariahiddenfalseworksinsubtreeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html (184889 => 184890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html        2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/LayoutTests/accessibility/aria-hidden-false-works-in-subtrees.html        2015-05-27 00:53:00 UTC (rev 184890)
</span><span class="lines">@@ -5,20 +5,59 @@
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body id=&quot;body&quot;&gt;
</span><span class="cx"> 
</span><ins>+&lt;div id=&quot;content&quot;&gt;
+
</ins><span class="cx"> &lt;div hidden aria-hidden=&quot;false&quot; aria-label=&quot;group0&quot;&gt;
</span><span class="cx">    &lt;div aria-hidden=&quot;true&quot; aria-label=&quot;group1&quot;&gt;
</span><span class="cx">       ignore me
</span><span class="cx">    &lt;/div&gt;
</span><del>-   &lt;div role=&quot;group&quot; aria-label=&quot;group2&quot;&gt;
-     &lt;div role=&quot;button&quot; aria-label=&quot;button1&quot;&gt;button&lt;/div&gt;
</del><ins>+   &lt;div aria-hidden=&quot;false&quot; role=&quot;group&quot; aria-label=&quot;group2&quot;&gt;
+     &lt;div aria-hidden=&quot;false&quot; role=&quot;button&quot; aria-label=&quot;button1&quot;&gt;button&lt;/div&gt;
</ins><span class="cx">      don't ignore me
</span><span class="cx">   &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;!-- The text node should be visible because it inherits from the parent --&gt;
+&lt;div id=&quot;group3&quot; hidden aria-hidden=&quot;false&quot;&gt;
+text3
+&lt;/div&gt;
+
+&lt;!-- The text node should be visible because it inherits from the parent, and all parents need aria-hidden=false --&gt;
+&lt;div id=&quot;group4&quot; hidden aria-hidden=&quot;false&quot;&gt;
+  &lt;div role=&quot;group&quot; hidden aria-hidden=&quot;false&quot;&gt;
+    text4
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;!-- The text node should NOT be visible because it inherits from the parent, and all parents need aria-hidden=false --&gt;
+&lt;div id=&quot;group5&quot; role=&quot;group&quot;&gt;
+  &lt;div hidden&gt;
+    &lt;div role=&quot;group&quot; hidden aria-hidden=&quot;false&quot;&gt;
+      text5
+    &lt;/div&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;!-- The button inside should NOT be visible because it is not marked as aria-hidden --&gt;
+&lt;div id=&quot;group6&quot; hidden aria-hidden=&quot;false&quot;&gt;
+  &lt;div aria-hidden=&quot;false&quot;&gt;
+     &lt;button&gt;button&lt;/button&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;!-- The button inside should be visible because it is marked as aria-hidden and all its parents are too --&gt;
+&lt;div id=&quot;group7&quot; hidden aria-hidden=&quot;false&quot;&gt;
+  &lt;div aria-hidden=&quot;false&quot;&gt;
+     &lt;button aria-hidden=&quot;false&quot;&gt;button&lt;/button&gt;
+  &lt;/div&gt;
+&lt;/div&gt;
+
</ins><span class="cx"> &lt;div id=&quot;iframe&quot;&gt;
</span><span class="cx"> &lt;iframe onload=&quot;testiFrameContent();&quot; aria-hidden=&quot;false&quot; src=&quot;resources/cake.png&quot;&gt;hidden content&lt;/iframe&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><ins>+&lt;/div&gt;
+
</ins><span class="cx"> &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
</span><span class="cx"> &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -34,6 +73,8 @@
</span><span class="cx">         iframeChild = iframe.childAtIndex(0);
</span><span class="cx">         debug(&quot;iFrame child role: &quot; + iframeChild.role);
</span><span class="cx"> 
</span><ins>+        document.getElementById(&quot;content&quot;).style.visibility = &quot;hidden&quot;;
+
</ins><span class="cx">         finishJSTest();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -53,10 +94,37 @@
</span><span class="cx">     if (window.accessibilityController) {
</span><span class="cx">         window.jsTestIsAsync = true;
</span><span class="cx"> 
</span><del>-        var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
</del><ins>+        var root = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0); 
</ins><span class="cx">         dumpAccessibilityChildren(root, 0);
</span><del>-}
</del><span class="cx"> 
</span><ins>+        // Text inside aria-hidden=false inherits from parent.
+        var object = accessibilityController.accessibleElementById(&quot;group3&quot;).childAtIndex(0);
+        shouldBe(&quot;object.role&quot;, &quot;'AXRole: AXStaticText'&quot;);
+        var stringValue = object.stringValue.replace(/\n/g, '');
+        shouldBe(&quot;stringValue&quot;, &quot;'AXValue: text3'&quot;);
+
+        // Text inside nested aria-hidden=false inherits from parent.
+        object = accessibilityController.accessibleElementById(&quot;group4&quot;).childAtIndex(0).childAtIndex(0);
+        shouldBe(&quot;object.role&quot;, &quot;'AXRole: AXStaticText'&quot;);
+        stringValue = object.stringValue.replace(/\n/g, '');
+        shouldBe(&quot;stringValue&quot;, &quot;'AXValue:     text4  '&quot;);
+
+        // When not all the parents have aria-hidden=false, element should not be visible.
+        object = accessibilityController.accessibleElementById(&quot;group5&quot;).childAtIndex(0);
+        shouldBeTrue(&quot;!object || !object.isValid&quot;);
+
+        // Objects that don't have aria-hidden=false are not visible when the parents have that attribute.
+        object = accessibilityController.accessibleElementById(&quot;group6&quot;).childAtIndex(0);
+        shouldBe(&quot;object.role&quot;, &quot;'AXRole: AXGroup'&quot;);
+        shouldBe(&quot;object.childrenCount&quot;, &quot;0&quot;);
+
+        // When all objects have aria-hidden=false, then the elements are visible.
+        object = accessibilityController.accessibleElementById(&quot;group7&quot;).childAtIndex(0);
+        shouldBe(&quot;object.role&quot;, &quot;'AXRole: AXGroup'&quot;);
+        shouldBe(&quot;object.childrenCount&quot;, &quot;1&quot;);
+        shouldBe(&quot;object.childAtIndex(0).role&quot;, &quot;'AXRole: AXButton'&quot;);
+    }
+
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184889 => 184890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/Source/WebCore/ChangeLog        2015-05-27 00:53:00 UTC (rev 184890)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-05-26  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: display:none content exposed to accessibility when aria-hidden is toggled on ancestor element
+        https://bugs.webkit.org/show_bug.cgi?id=139142
+
+        Reviewed by Darin Adler.
+     
+        Amend the code that determines when an invisible, but aria-hidden=false, element is exposed to accessibility.
+
+        The new guideline is that you must have aria-hidden=false on every node that is not rendered (except text which inherits)
+        otherwise the element will not be visible.
+
+        Modified existing test: accessibility/aria-hidden-false-works-in-subtrees.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::isNodeAriaVisible):
+        (WebCore::AXObjectCache::rootWebArea):
+
</ins><span class="cx"> 2015-05-26  Roger Fong  &lt;roger_fong@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Enable element unsigned index in WebGL2 again.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (184889 => 184890)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-05-27 00:18:58 UTC (rev 184889)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-05-27 00:53:00 UTC (rev 184890)
</span><span class="lines">@@ -1300,20 +1300,30 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><span class="cx">         return false;
</span><del>-    
-    // To determine if a node is ARIA visible, we need to check the parent hierarchy to see if anyone specifies
-    // aria-hidden explicitly.
</del><ins>+
+    // ARIA Node visibility is controlled by aria-hidden
+    //  1) if aria-hidden=true, the whole subtree is hidden
+    //  2) if aria-hidden=false, and the object is rendered, there's no effect
+    //  3) if aria-hidden=false, and the object is NOT rendered, then it must have
+    //     aria-hidden=false on each parent until it gets to a rendered object
+    //  3b) a text node inherits a parents aria-hidden value
+    bool requiresAriaHiddenFalse = !node-&gt;renderer();
+    bool ariaHiddenFalsePresent = false;
</ins><span class="cx">     for (Node* testNode = node; testNode; testNode = testNode-&gt;parentNode()) {
</span><span class="cx">         if (is&lt;Element&gt;(*testNode)) {
</span><span class="cx">             const AtomicString&amp; ariaHiddenValue = downcast&lt;Element&gt;(*testNode).fastGetAttribute(aria_hiddenAttr);
</span><del>-            if (equalIgnoringCase(ariaHiddenValue, &quot;false&quot;))
-                return true;
</del><span class="cx">             if (equalIgnoringCase(ariaHiddenValue, &quot;true&quot;))
</span><span class="cx">                 return false;
</span><ins>+            
+            bool ariaHiddenFalse = equalIgnoringCase(ariaHiddenValue, &quot;false&quot;);
+            if (!testNode-&gt;renderer() &amp;&amp; !ariaHiddenFalse)
+                return false;
+            if (!ariaHiddenFalsePresent &amp;&amp; ariaHiddenFalse)
+                ariaHiddenFalsePresent = true;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    return false;
</del><ins>+    return !requiresAriaHiddenFalse || ariaHiddenFalsePresent;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> AccessibilityObject* AXObjectCache::rootWebArea()
</span></span></pre>
</div>
</div>

</body>
</html>