<!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>[174074] 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/174074">174074</a></dd>
<dt>Author</dt> <dd>cfleizach@apple.com</dd>
<dt>Date</dt> <dd>2014-09-29 11:18:44 -0700 (Mon, 29 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: in an aria-labelledby computation, do not traverse into elements whose nameFrom value does not include 'contents'
https://bugs.webkit.org/show_bug.cgi?id=136714

Reviewed by Darin Adler.

Source/WebCore:

There are certain ARIA elements that tell us we should not query their children when determining the name of the object.
Those ones have the &quot;nameFrom&quot; property set to &quot;author&quot; instead of &quot;contents.&quot; WebKit needs to honor that status.

Test: accessibility/aria-namefrom-author.html
      Modified: accessibility/aria-labelledby-with-descendants.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::shouldUseAccessiblityObjectInnerText):
(WebCore::shouldAddSpaceBeforeAppendingNextElement):
(WebCore::appendNameToStringBuilder):
(WebCore::AccessibilityNodeObject::textUnderElement):
(WebCore::accessibleNameForNode):
(WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
(WebCore::initializeRoleMap):
* accessibility/AccessibilityObject.h:

LayoutTests:

* accessibility/aria-labelledby-with-descendants-expected.txt:
* accessibility/aria-labelledby-with-descendants.html:
* accessibility/aria-namefrom-author-expected.txt: Added.
* accessibility/aria-namefrom-author.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityarialabelledbywithdescendantsexpectedtxt">trunk/LayoutTests/accessibility/aria-labelledby-with-descendants-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityarialabelledbywithdescendantshtml">trunk/LayoutTests/accessibility/aria-labelledby-with-descendants.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilityarianamefromauthorexpectedtxt">trunk/LayoutTests/accessibility/aria-namefrom-author-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityarianamefromauthorhtml">trunk/LayoutTests/accessibility/aria-namefrom-author.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/LayoutTests/ChangeLog        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-09-29  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: in an aria-labelledby computation, do not traverse into elements whose nameFrom value does not include 'contents'
+        https://bugs.webkit.org/show_bug.cgi?id=136714
+
+        Reviewed by Darin Adler.
+
+        * accessibility/aria-labelledby-with-descendants-expected.txt:
+        * accessibility/aria-labelledby-with-descendants.html:
+        * accessibility/aria-namefrom-author-expected.txt: Added.
+        * accessibility/aria-namefrom-author.html: Added.
+
</ins><span class="cx"> 2014-09-29  Diego Pino Garcia  &lt;dpino@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Missing changes from r174049
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityarialabelledbywithdescendantsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-labelledby-with-descendants-expected.txt (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-labelledby-with-descendants-expected.txt        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/LayoutTests/accessibility/aria-labelledby-with-descendants-expected.txt        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -1,3 +1,5 @@
</span><ins>+
+
</ins><span class="cx"> This tests that if aria-labelledby is pointing to nodes with descendants, it returns all text.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="lines">@@ -3,5 +5,25 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-aria-labelledby description: AXDescription: hello link world test1 test2 test3
</del><ins>+test 1: aria-labelledby description: AXDescription: hello link use world test1 test2 test3
+test 1: expected description: hello link use world test1 test2 test3
+
+test 2: aria-labelledby description: AXDescription: foo bar
+test 2: expected description: foo bar
+
+test 3: aria-labelledby description: AXDescription: foo bar
+test 3: expected description: foo bar
+
+test 4: aria-labelledby description: AXDescription: foo
+test 4: expected description: foo
+
+test 5: aria-labelledby description: AXDescription: Delete 
+test 5: expected description: Delete
+
+test 6: aria-labelledby description: AXDescription: Delete product name
+test 6: expected description: Delete product name
+
+test 7: aria-labelledby description: AXDescription: foo bar baz bop bap boom
+test 7: expected description: foo bar baz bop bap boom
+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityarialabelledbywithdescendantshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-labelledby-with-descendants.html (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-labelledby-with-descendants.html        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/LayoutTests/accessibility/aria-labelledby-with-descendants.html        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -7,19 +7,36 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;div id=&quot;content&quot;&gt;
</span><span class="cx"> 
</span><del>-&lt;div aria-labelledby=&quot;a b&quot; id=&quot;group&quot; role=&quot;group&quot;&gt;
-group text
-&lt;/div&gt;
</del><ins>+&lt;div class=&quot;ex&quot; data-label=&quot;hello link use world test1 test2 test3&quot; aria-labelledby=&quot;a1 b1&quot; id=&quot;test1&quot; role=&quot;group&quot;&gt;group text&lt;/div&gt;
+&lt;div id=&quot;a1&quot;&gt;hello &lt;a href=&quot;#&quot;&gt;link&lt;/a&gt; &lt;div role=&quot;group&quot;&gt;skip&lt;/div&gt; &lt;div role=&quot;group&quot; aria-label=&quot;use&quot;&gt;skip&lt;/div&gt; world&lt;/div&gt;
+&lt;!-- paragraph role is ambiguous so okay to leave next example as it --&gt;
+&lt;div id=&quot;b1&quot;&gt;&lt;button&gt;test1&lt;/button&gt;&lt;p tabindex=0&gt;test2 &lt;span aria-hidden=&quot;true&quot;&gt;hidden&lt;/span&gt; test3&lt;/p&gt;&lt;/div&gt;
</ins><span class="cx"> 
</span><del>-&lt;div id=&quot;a&quot;&gt;
-hello &lt;a href=&quot;#&quot;&gt;link&lt;/a&gt; world
-&lt;/div&gt;
</del><ins>+&lt;input type=&quot;checkbox&quot; aria-labelledby=&quot;reverselabelfor&quot; id=&quot;test2&quot; class=&quot;ex&quot; data-label=&quot;foo bar&quot; data-note=&quot;labelled by label element&quot;&gt;
+&lt;label id=&quot;reverselabelfor&quot;&gt;foo &lt;span role=&quot;text&quot; aria-label=&quot;bar&quot;&gt;skip&lt;/span&gt;&lt;/label&gt;
+&lt;br&gt;
</ins><span class="cx"> 
</span><del>-&lt;div id=&quot;b&quot;&gt;
-&lt;button&gt;test1&lt;/button&gt; 
-&lt;p tabindex=0&gt;test2 &lt;span aria-hidden=&quot;true&quot;&gt;hidden&lt;/span&gt; test3&lt;/p&gt;
-&lt;/div&gt;
</del><ins>+&lt;input type=&quot;checkbox&quot; aria-labelledby=&quot;reverselabelforwithdiv&quot; id=&quot;test3&quot; class=&quot;ex&quot; data-label=&quot;foo bar&quot; data-note=&quot;labelled by div element&quot;&gt;
+&lt;div id=&quot;reverselabelforwithdiv&quot;&gt;foo &lt;span role=&quot;text&quot; aria-label=&quot;bar&quot;&gt;skip&lt;/span&gt;&lt;/div&gt;
+&lt;br&gt;
</ins><span class="cx"> 
</span><ins>+&lt;!-- would be &quot;bar&quot; natively, but label explicitly overridden to &quot;foo&quot; by labelledby --&gt;
+&lt;div id=&quot;overridesnativelabel&quot;&gt;foo&lt;/div&gt;&lt;label for=&quot;nativelabeloverridden&quot;&gt;bar&lt;/label&gt;
+&lt;input class=&quot;ex&quot; data-label=&quot;foo&quot; id=&quot;test4&quot; type=&quot;text&quot; aria-labelledby=&quot;overridesnativelabel&quot; data-note=&quot;overrides native label&quot;&gt;
+
+&lt;!-- self-referencing labelledby in combination with external reference --&gt;
+&lt;div id=&quot;productname1&quot;&gt;&lt;nav role=&quot;navigation&quot;&gt;&lt;!-- nav does not get nameFrom:contents --&gt;product name&lt;/nav&gt;&lt;/div&gt;
+&lt;button class=&quot;ex&quot; data-label=&quot;Delete&quot; aria-label=&quot;Delete&quot; aria-labelledby=&quot;test5 productname1&quot; id=&quot;test5&quot; data-note=&quot;self-referencial labelledby includes nav&quot;&gt;x&lt;/button&gt;
+
+&lt;!-- self-referencing labelledby in combination with external reference --&gt;
+&lt;div id=&quot;productname2&quot;&gt;&lt;nav role=&quot;heading&quot;&gt;&lt;!-- nav does not get nameFrom:contents, but heading does. --&gt;product name&lt;/nav&gt;&lt;/div&gt;
+&lt;button class=&quot;ex&quot; data-label=&quot;Delete product name&quot; aria-label=&quot;Delete&quot; aria-labelledby=&quot;test6 productname2&quot; id=&quot;test6&quot; data-note=&quot;self-referencial labelledby includes heading&quot;&gt;x&lt;/button&gt;
+
+&lt;div class=&quot;ex&quot; data-label=&quot;foo bar baz bop bap boom&quot; aria-labelledby=&quot;a3 b3&quot; id=&quot;test7&quot; role=&quot;group&quot; data-note=&quot;includes form elements&quot;&gt;foo&lt;/div&gt;
+&lt;button id=&quot;a3&quot;&gt; foo &lt;img src=&quot;#&quot; alt=&quot;bar&quot;&gt; baz&lt;/button&gt;
+&lt;div id=&quot;b3&quot;&gt;bop &lt;input value=&quot;bap&quot;&gt; &lt;input type=&quot;range&quot; aria-valuetext=&quot;boom&quot;&gt;&lt;/div&gt;
+
+
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
</span><span class="lines">@@ -30,8 +47,11 @@
</span><span class="cx">     description(&quot;This tests that if aria-labelledby is pointing to nodes with descendants, it returns all text.&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><del>-          var group = accessibilityController.accessibleElementById(&quot;group&quot;);
-          debug(&quot;aria-labelledby description: &quot; + group.description);
</del><ins>+          for (var k = 1; k &lt; 8; k++) {
+              var test = accessibilityController.accessibleElementById(&quot;test&quot; + k);
+              debug(&quot;test &quot; + k + &quot;: aria-labelledby description: &quot; + test.description);
+              debug(&quot;test &quot; + k + &quot;: expected description: &quot; + document.getElementById(&quot;test&quot; + k).getAttribute(&quot;data-label&quot;) + &quot;\n&quot;);
+          }
</ins><span class="cx">           document.getElementById(&quot;content&quot;).style.visibility = &quot;hidden&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityarianamefromauthorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-namefrom-author-expected.txt (0 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-namefrom-author-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/aria-namefrom-author-expected.txt        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests all the cases where nameFrom: author is used instead of nameFrom: contents. This means that if these elements are used in aria-labelledby they should not return their inner text. The button should retain its aria-label as the description.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Button description: AXDescription: text
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityarianamefromauthorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/aria-namefrom-author.html (0 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-namefrom-author.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/aria-namefrom-author.html        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+&lt;div id=&quot;content&quot;&gt;
+
+&lt;div id=&quot;test1&quot; class=&quot;test&quot; role=&quot;alert&quot;&gt;alert&lt;/div&gt;
+&lt;div id=&quot;test2&quot; class=&quot;test&quot; role=&quot;alertdialog&quot;&gt;alertdialog&lt;/div&gt;
+&lt;div id=&quot;test3&quot; class=&quot;test&quot; role=&quot;dialog&quot;&gt;dialog&lt;/div&gt;
+&lt;div id=&quot;test4&quot; class=&quot;test&quot; role=&quot;log&quot;&gt;log&lt;/div&gt;
+&lt;div id=&quot;test5&quot; class=&quot;test&quot; role=&quot;marquee&quot;&gt;marquee&lt;/div&gt;
+&lt;div id=&quot;test6&quot; class=&quot;test&quot; role=&quot;status&quot;&gt;status&lt;/div&gt;
+&lt;div id=&quot;test7&quot; class=&quot;test&quot; role=&quot;timer&quot;&gt;timer&lt;/div&gt;
+&lt;div id=&quot;test8&quot; class=&quot;test&quot; role=&quot;combobox&quot;&gt;combobox&lt;/div&gt;
+&lt;div id=&quot;test9&quot; class=&quot;test&quot; role=&quot;definition&quot;&gt;definition&lt;/div&gt;
+&lt;div id=&quot;test10&quot; class=&quot;test&quot; role=&quot;document&quot;&gt;document&lt;/div&gt;
+&lt;div id=&quot;test11&quot; class=&quot;test&quot; role=&quot;article&quot;&gt;article&lt;/div&gt;
+&lt;div id=&quot;test12&quot; class=&quot;test&quot; role=&quot;math&quot;&gt;math&lt;/div&gt;
+&lt;div id=&quot;test13&quot; class=&quot;test&quot; role=&quot;note&quot;&gt;note&lt;/div&gt;
+&lt;div id=&quot;test14&quot; class=&quot;test&quot; role=&quot;region&quot;&gt;region&lt;/div&gt;
+&lt;div id=&quot;test15&quot; class=&quot;test&quot; role=&quot;form&quot;&gt;form&lt;/div&gt;
+&lt;div id=&quot;test16&quot; class=&quot;test&quot; role=&quot;grid&quot;&gt;grid&lt;/div&gt;
+&lt;div id=&quot;test17&quot; class=&quot;test&quot; role=&quot;group&quot;&gt;group&lt;/div&gt;
+&lt;div id=&quot;test18&quot; class=&quot;test&quot; role=&quot;img&quot;&gt;img&lt;/div&gt;
+&lt;div id=&quot;test19&quot; class=&quot;test&quot; role=&quot;list&quot;&gt;list&lt;/div&gt;
+&lt;div id=&quot;test20&quot; class=&quot;test&quot; role=&quot;listbox&quot;&gt;listbox&lt;/div&gt;
+&lt;div id=&quot;test21&quot; class=&quot;test&quot; role=&quot;application&quot;&gt;application&lt;/div&gt;
+&lt;div id=&quot;test22&quot; class=&quot;test&quot; role=&quot;banner&quot;&gt;banner&lt;/div&gt;
+&lt;div id=&quot;test23&quot; class=&quot;test&quot; role=&quot;complementary&quot;&gt;complementary&lt;/div&gt;
+&lt;div id=&quot;test24&quot; class=&quot;test&quot; role=&quot;contentinfo&quot;&gt;contentinfo&lt;/div&gt;
+&lt;div id=&quot;test25&quot; class=&quot;test&quot; role=&quot;navigation&quot;&gt;navigation&lt;/div&gt;
+&lt;div id=&quot;test26&quot; class=&quot;test&quot; role=&quot;main&quot;&gt;main&lt;/div&gt;
+&lt;div id=&quot;test27&quot; class=&quot;test&quot; role=&quot;search&quot;&gt;search&lt;/div&gt;
+&lt;div id=&quot;test28&quot; class=&quot;test&quot; role=&quot;menu&quot;&gt;menu&lt;/div&gt;
+&lt;div id=&quot;test29&quot; class=&quot;test&quot; role=&quot;menubar&quot;&gt;menubar&lt;/div&gt;
+&lt;div id=&quot;test30&quot; class=&quot;test&quot; role=&quot;progressbar&quot;&gt;progressbar&lt;/div&gt;
+&lt;div id=&quot;test31&quot; class=&quot;test&quot; role=&quot;radiogroup&quot;&gt;radiogroup&lt;/div&gt;
+&lt;div id=&quot;test32&quot; class=&quot;test&quot; role=&quot;scrollbar&quot;&gt;scrollbar&lt;/div&gt;
+&lt;div id=&quot;test33&quot; class=&quot;test&quot; role=&quot;slider&quot;&gt;slider&lt;/div&gt;
+&lt;div id=&quot;test34&quot; class=&quot;test&quot; role=&quot;spinbutton&quot;&gt;spinbutton&lt;/div&gt;
+&lt;div id=&quot;test35&quot; class=&quot;test&quot; role=&quot;separator&quot;&gt;separator&lt;/div&gt;
+&lt;div id=&quot;test36&quot; class=&quot;test&quot; role=&quot;tablist&quot;&gt;tablist&lt;/div&gt;
+&lt;div id=&quot;test37&quot; class=&quot;test&quot; role=&quot;tabpanel&quot;&gt;tabpanel&lt;/div&gt;
+&lt;div id=&quot;test38&quot; class=&quot;test&quot; role=&quot;textbox&quot;&gt;textbox&lt;/div&gt;
+&lt;div id=&quot;test39&quot; class=&quot;test&quot; role=&quot;toolbar&quot;&gt;toolbar&lt;/div&gt;
+&lt;div id=&quot;test40&quot; class=&quot;test&quot; role=&quot;treegrid&quot;&gt;treegrid&lt;/div&gt;
+&lt;div id=&quot;test41&quot; class=&quot;test&quot; role=&quot;tree&quot;&gt;tree&lt;/div&gt;
+
+
+&lt;div role=&quot;button&quot; id=&quot;button&quot; aria-label=&quot;text&quot;&gt;button text&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+
+    description(&quot;This tests all the cases where nameFrom: author is used instead of nameFrom: contents. This means that if these elements are used in aria-labelledby they should not return their inner text. The button should retain its aria-label as the description.&quot;);
+
+    var labelledby = &quot;&quot;;
+    for (var k = 1; k &lt; 42; k++) {
+        labelledby += &quot;test&quot; + k + &quot; &quot;;
+    }
+    document.getElementById(&quot;button&quot;).setAttribute(&quot;aria-labelledby&quot;, labelledby);
+
+    if (window.accessibilityController) {
+        debug(&quot;Button description: &quot; + accessibilityController.accessibleElementById(&quot;button&quot;).description);
+        document.getElementById(&quot;content&quot;).style.visibility = &quot;hidden&quot;;
+    }
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/Source/WebCore/ChangeLog        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-09-29  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: in an aria-labelledby computation, do not traverse into elements whose nameFrom value does not include 'contents'
+        https://bugs.webkit.org/show_bug.cgi?id=136714
+
+        Reviewed by Darin Adler.
+
+        There are certain ARIA elements that tell us we should not query their children when determining the name of the object.
+        Those ones have the &quot;nameFrom&quot; property set to &quot;author&quot; instead of &quot;contents.&quot; WebKit needs to honor that status.
+
+        Test: accessibility/aria-namefrom-author.html
+              Modified: accessibility/aria-labelledby-with-descendants.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::shouldUseAccessiblityObjectInnerText):
+        (WebCore::shouldAddSpaceBeforeAppendingNextElement):
+        (WebCore::appendNameToStringBuilder):
+        (WebCore::AccessibilityNodeObject::textUnderElement):
+        (WebCore::accessibleNameForNode):
+        (WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
+        (WebCore::initializeRoleMap):
+        * accessibility/AccessibilityObject.h:
+
</ins><span class="cx"> 2014-09-29  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Optimize media controls AirPlay discovery
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -1609,6 +1609,11 @@
</span><span class="cx">     // quite long. As a heuristic, skip links, controls, and elements that are usually
</span><span class="cx">     // containers with lots of children.
</span><span class="cx"> 
</span><ins>+    // ARIA states that certain elements are not allowed to expose their children content for name calculation.
+    if (mode.childrenInclusion == AccessibilityTextUnderElementMode::TextUnderElementModeIncludeNameFromContentsChildren
+        &amp;&amp; !obj-&gt;accessibleNameDerivesFromContent())
+        return false;
+    
</ins><span class="cx">     if (equalIgnoringCase(obj-&gt;getAttribute(aria_hiddenAttr), &quot;true&quot;))
</span><span class="cx">         return false;
</span><span class="cx">     
</span><span class="lines">@@ -1628,7 +1633,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool shouldAddSpaceBeforeAppendingNextElement(StringBuilder&amp; builder, String&amp; childText)
</del><ins>+static bool shouldAddSpaceBeforeAppendingNextElement(StringBuilder&amp; builder, const String&amp; childText)
</ins><span class="cx"> {
</span><span class="cx">     if (!builder.length() || !childText.length())
</span><span class="cx">         return false;
</span><span class="lines">@@ -1636,6 +1641,13 @@
</span><span class="cx">     // We don't need to add an additional space before or after a line break.
</span><span class="cx">     return !(isHTMLLineBreak(childText[0]) || isHTMLLineBreak(builder[builder.length() - 1]));
</span><span class="cx"> }
</span><ins>+    
+static void appendNameToStringBuilder(StringBuilder&amp; builder, const String&amp; text)
+{
+    if (shouldAddSpaceBeforeAppendingNextElement(builder, text))
+        builder.append(' ');
+    builder.append(text);
+}
</ins><span class="cx"> 
</span><span class="cx"> String AccessibilityNodeObject::textUnderElement(AccessibilityTextUnderElementMode mode) const
</span><span class="cx"> {
</span><span class="lines">@@ -1651,6 +1663,13 @@
</span><span class="cx"> 
</span><span class="cx">     StringBuilder builder;
</span><span class="cx">     for (AccessibilityObject* child = firstChild(); child; child = child-&gt;nextSibling()) {
</span><ins>+        
+        bool shouldDeriveNameFromAuthor = (mode.childrenInclusion == AccessibilityTextUnderElementMode::TextUnderElementModeIncludeNameFromContentsChildren &amp;&amp; !child-&gt;accessibleNameDerivesFromContent());
+        if (shouldDeriveNameFromAuthor) {
+            appendNameToStringBuilder(builder, accessibleNameForNode(child-&gt;node()));
+            continue;
+        }
+        
</ins><span class="cx">         if (!shouldUseAccessiblityObjectInnerText(child, mode))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="lines">@@ -1658,19 +1677,14 @@
</span><span class="cx">             Vector&lt;AccessibilityText&gt; textOrder;
</span><span class="cx">             toAccessibilityNodeObject(child)-&gt;alternativeText(textOrder);
</span><span class="cx">             if (textOrder.size() &gt; 0 &amp;&amp; textOrder[0].text.length()) {
</span><del>-                if (shouldAddSpaceBeforeAppendingNextElement(builder, textOrder[0].text))
-                    builder.append(' ');
-                builder.append(textOrder[0].text);
</del><ins>+                appendNameToStringBuilder(builder, textOrder[0].text);
</ins><span class="cx">                 continue;
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-
</del><ins>+        
</ins><span class="cx">         String childText = child-&gt;textUnderElement(mode);
</span><del>-        if (childText.length()) {
-            if (shouldAddSpaceBeforeAppendingNextElement(builder, childText))
-                builder.append(' ');
-            builder.append(childText);
-        }
</del><ins>+        if (childText.length())
+            appendNameToStringBuilder(builder, childText);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return builder.toString().stripWhiteSpace().simplifyWhiteSpace(isHTMLSpaceButNotLineBreak);
</span><span class="lines">@@ -1839,19 +1853,26 @@
</span><span class="cx">     const AtomicString&amp; alt = element-&gt;fastGetAttribute(altAttr);
</span><span class="cx">     if (!alt.isEmpty())
</span><span class="cx">         return alt;
</span><ins>+
+    // If the node can be turned into an AX object, we can use standard name computation rules.
+    // If however, the node cannot (because there's no renderer e.g.) fallback to using the basic text underneath.
+    AccessibilityObject* axObject = node-&gt;document().axObjectCache()-&gt;getOrCreate(node);
+    if (axObject) {
+        String valueDescription = axObject-&gt;valueDescription();
+        if (!valueDescription.isEmpty())
+            return valueDescription;
+    }
</ins><span class="cx">     
</span><span class="cx">     if (is&lt;HTMLInputElement&gt;(node))
</span><span class="cx">         return downcast&lt;HTMLInputElement&gt;(*node).value();
</span><span class="cx">     
</span><del>-    // If the node can be turned into an AX object, we can use standard name computation rules.
-    // If however, the node cannot (because there's no renderer e.g.) fallback to using the basic text underneath.
-    AccessibilityObject* axObject = node-&gt;document().axObjectCache()-&gt;getOrCreate(node);
</del><span class="cx">     String text;
</span><del>-    if (axObject)
-        text = axObject-&gt;textUnderElement(AccessibilityTextUnderElementMode(AccessibilityTextUnderElementMode::TextUnderElementModeSkipIgnoredChildren, true));
-    else
</del><ins>+    if (axObject) {
+        if (axObject-&gt;accessibleNameDerivesFromContent())
+            text = axObject-&gt;textUnderElement(AccessibilityTextUnderElementMode(AccessibilityTextUnderElementMode::TextUnderElementModeIncludeNameFromContentsChildren, true));
+    } else
</ins><span class="cx">         text = element-&gt;innerText();
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (!text.isEmpty())
</span><span class="cx">         return text;
</span><span class="cx">     
</span><span class="lines">@@ -1866,12 +1887,8 @@
</span><span class="cx"> {
</span><span class="cx">     StringBuilder builder;
</span><span class="cx">     unsigned size = elements.size();
</span><del>-    for (unsigned i = 0; i &lt; size; ++i) {
-        if (i)
-            builder.append(' ');
-        
-        builder.append(accessibleNameForNode(elements[i]));
-    }
</del><ins>+    for (unsigned i = 0; i &lt; size; ++i)
+        appendNameToStringBuilder(builder, accessibleNameForNode(elements[i]));
</ins><span class="cx">     return builder.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -287,7 +287,71 @@
</span><span class="cx">         || accessibilityDescription().contains(*text, false)
</span><span class="cx">         || stringValue().contains(*text, false);
</span><span class="cx"> }
</span><ins>+
+// ARIA marks elements as having their accessible name derive from either their contents, or their author provide name.
+bool AccessibilityObject::accessibleNameDerivesFromContent() const
+{
+    // First check for objects specifically identified by ARIA.
+    switch (ariaRoleAttribute()) {
+    case ApplicationAlertRole:
+    case ApplicationAlertDialogRole:
+    case ApplicationDialogRole:
+    case ApplicationLogRole:
+    case ApplicationMarqueeRole:
+    case ApplicationStatusRole:
+    case ApplicationTimerRole:
+    case ComboBoxRole:
+    case DefinitionRole:
+    case DocumentRole:
+    case DocumentArticleRole:
+    case DocumentMathRole:
+    case DocumentNoteRole:
+    case DocumentRegionRole:
+    case FormRole:
+    case GridRole:
+    case GroupRole:
+    case ImageRole:
+    case ListRole:
+    case ListBoxRole:
+    case LandmarkApplicationRole:
+    case LandmarkBannerRole:
+    case LandmarkComplementaryRole:
+    case LandmarkContentInfoRole:
+    case LandmarkNavigationRole:
+    case LandmarkMainRole:
+    case LandmarkSearchRole:
+    case MenuRole:
+    case MenuBarRole:
+    case ProgressIndicatorRole:
+    case RadioGroupRole:
+    case ScrollBarRole:
+    case SliderRole:
+    case SpinButtonRole:
+    case SplitterRole:
+    case TableRole:
+    case TabListRole:
+    case TabPanelRole:
+    case TextAreaRole:
+    case TextFieldRole:
+    case ToolbarRole:
+    case TreeGridRole:
+    case TreeRole:
+        return false;
+    default:
+        break;
+    }
</ins><span class="cx">     
</span><ins>+    // Now check for generically derived elements now that we know the element does not match a specific ARIA role.
+    switch (roleValue()) {
+    case SliderRole:
+        return false;
+    default:
+        break;
+    }
+    
+    return true;
+}
+    
</ins><span class="cx"> String AccessibilityObject::computedLabel()
</span><span class="cx"> {
</span><span class="cx">     // This method is being called by WebKit inspector, which may happen at any time, so we need to update our backing store now.
</span><span class="lines">@@ -1795,6 +1859,7 @@
</span><span class="cx">         { &quot;combobox&quot;, ComboBoxRole },
</span><span class="cx">         { &quot;definition&quot;, DefinitionRole },
</span><span class="cx">         { &quot;document&quot;, DocumentRole },
</span><ins>+        { &quot;form&quot;, FormRole },
</ins><span class="cx">         { &quot;rowheader&quot;, RowHeaderRole },
</span><span class="cx">         { &quot;group&quot;, GroupRole },
</span><span class="cx">         { &quot;heading&quot;, HeadingRole },
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (174073 => 174074)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2014-09-29 18:12:13 UTC (rev 174073)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2014-09-29 18:18:44 UTC (rev 174074)
</span><span class="lines">@@ -248,6 +248,7 @@
</span><span class="cx">     enum ChildrenInclusion {
</span><span class="cx">         TextUnderElementModeSkipIgnoredChildren,
</span><span class="cx">         TextUnderElementModeIncludeAllChildren,
</span><ins>+        TextUnderElementModeIncludeNameFromContentsChildren, // This corresponds to ARIA concept: nameFrom
</ins><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     ChildrenInclusion childrenInclusion;
</span><span class="lines">@@ -667,6 +668,7 @@
</span><span class="cx">     virtual String ariaLabeledByAttribute() const { return String(); }
</span><span class="cx">     virtual String ariaDescribedByAttribute() const { return String(); }
</span><span class="cx">     const AtomicString&amp; placeholderValue() const;
</span><ins>+    bool accessibleNameDerivesFromContent() const;
</ins><span class="cx">     
</span><span class="cx">     // Abbreviations
</span><span class="cx">     virtual String expandedTextValue() const { return String(); }
</span></span></pre>
</div>
</div>

</body>
</html>