<!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>[206581] 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/206581">206581</a></dd>
<dt>Author</dt> <dd>n_wang@apple.com</dd>
<dt>Date</dt> <dd>2016-09-29 08:13:00 -0700 (Thu, 29 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
https://bugs.webkit.org/show_bug.cgi?id=162586

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed the label element's text as AXDescription for meter elements.
Also refactored the code for fetching the label element's text and taken care of
the case where aria-label and aria-labelledby attributes are used on label elements.

Test: accessibility/mac/meter-with-label-element.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isLabelable):
(WebCore::AccessibilityNodeObject::textForLabelElement):
(WebCore::AccessibilityNodeObject::titleElementText):
(WebCore::AccessibilityNodeObject::title):
(WebCore::AccessibilityNodeObject::usesAltTagForTextComputation): Deleted.
* accessibility/AccessibilityNodeObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::exposesTitleUIElement):

LayoutTests:

* accessibility/mac/aria-label-on-label-element-expected.txt:
* accessibility/mac/aria-label-on-label-element.html:
* accessibility/mac/meter-with-label-element-expected.txt: Added.
* accessibility/mac/meter-with-label-element.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacarialabelonlabelelementexpectedtxt">trunk/LayoutTests/accessibility/mac/aria-label-on-label-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacarialabelonlabelelementhtml">trunk/LayoutTests/accessibility/mac/aria-label-on-label-element.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="#trunkSourceWebCoreaccessibilityAccessibilityNodeObjecth">trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilitymacmeterwithlabelelementexpectedtxt">trunk/LayoutTests/accessibility/mac/meter-with-label-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacmeterwithlabelelementhtml">trunk/LayoutTests/accessibility/mac/meter-with-label-element.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/LayoutTests/ChangeLog        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-09-29  Nan Wang  &lt;n_wang@apple.com&gt;
+
+        AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
+        https://bugs.webkit.org/show_bug.cgi?id=162586
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/aria-label-on-label-element-expected.txt:
+        * accessibility/mac/aria-label-on-label-element.html:
+        * accessibility/mac/meter-with-label-element-expected.txt: Added.
+        * accessibility/mac/meter-with-label-element.html: Added.
+
</ins><span class="cx"> 2016-09-28  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Import touch-events web-platform-tests
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacarialabelonlabelelementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/aria-label-on-label-element-expected.txt (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/aria-label-on-label-element-expected.txt        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/LayoutTests/accessibility/mac/aria-label-on-label-element-expected.txt        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -1,4 +1,9 @@
</span><span class="cx"> Some text  Some other text   
</span><ins>+aria
+
+labelledby
+
+Some text 
</ins><span class="cx"> This tests that the aria-label attribute works on element.
</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">@@ -8,6 +13,7 @@
</span><span class="cx"> PASS input1.title is 'AXTitle: aria label'
</span><span class="cx"> PASS titleUIElement2.isEqual(accessibilityController.accessibleElementById('label2')) is true
</span><span class="cx"> PASS input3.title is 'AXTitle: hidden aria label'
</span><ins>+PASS input4.title is 'AXTitle: aria labelledby'
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacarialabelonlabelelementhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/aria-label-on-label-element.html (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/aria-label-on-label-element.html        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/LayoutTests/accessibility/mac/aria-label-on-label-element.html        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -14,6 +14,11 @@
</span><span class="cx"> &lt;label id=&quot;label3&quot; for=&quot;input3&quot; hidden aria-label=&quot;hidden aria label&quot;&gt;hidden text&lt;/label&gt;
</span><span class="cx"> &lt;input id=&quot;input3&quot; type=&quot;text&quot;&gt;
</span><span class="cx"> 
</span><ins>+&lt;p id=&quot;p1&quot;&gt;aria&lt;/p&gt;
+&lt;p id=&quot;p2&quot;&gt;labelledby&lt;/p&gt;
+&lt;label for=&quot;input4&quot; aria-labelledby=&quot;p1 p2&quot;&gt;Some text&lt;/label&gt;
+&lt;input id=&quot;input4&quot; type=&quot;text&quot; size=20&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">@@ -37,6 +42,10 @@
</span><span class="cx">         // Make sure when the input element has no rendered label, it won't cause crash.
</span><span class="cx">         var input3 = accessibilityController.accessibleElementById(&quot;input3&quot;);
</span><span class="cx">         shouldBe(&quot;input3.title&quot;, &quot;'AXTitle: hidden aria label'&quot;);
</span><ins>+        
+        // aria-labelledby also works.
+        var input4 = accessibilityController.accessibleElementById(&quot;input4&quot;);
+        shouldBe(&quot;input4.title&quot;, &quot;'AXTitle: aria labelledby'&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacmeterwithlabelelementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/meter-with-label-element-expected.txt (0 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/meter-with-label-element-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/meter-with-label-element-expected.txt        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+label  label wrapping meter label 
+aria
+
+labelledby
+
+label
+This tests that for meter elements, the label element should be used as accessible name.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS meter1.description is 'AXDescription: label'
+PASS meter2.description is 'AXDescription: label wrapping meter'
+PASS meter3.description is 'AXDescription: aria label'
+PASS meter4.description is 'AXDescription: aria labelledby'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacmeterwithlabelelementhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/meter-with-label-element.html (0 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/meter-with-label-element.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/meter-with-label-element.html        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -0,0 +1,44 @@
</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;label for=&quot;meter&quot;&gt;label&lt;/label&gt;
+&lt;meter id=&quot;meter&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;83.5&quot;&gt;&lt;/meter&gt;
+
+&lt;label&gt;label wrapping meter&lt;meter id=&quot;meter2&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;83.5&quot;&gt;&lt;/meter&gt;&lt;/label&gt;
+
+&lt;label for=&quot;meter3&quot; aria-label=&quot;aria label&quot;&gt;label&lt;/label&gt;
+&lt;meter id=&quot;meter3&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;83.5&quot;&gt;&lt;/meter&gt;
+
+&lt;p id=&quot;p1&quot;&gt;aria&lt;/p&gt;
+&lt;p id=&quot;p2&quot;&gt;labelledby&lt;/p&gt;
+&lt;label aria-labelledby=&quot;p1 p2&quot;&gt;label&lt;meter id=&quot;meter4&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;83.5&quot;&gt;&lt;/meter&gt;&lt;/label&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 that for meter elements, the label element should be used as accessible name.&quot;);
+
+    if (window.accessibilityController) {
+
+          var meter1 = accessibilityController.accessibleElementById(&quot;meter&quot;);
+          shouldBe(&quot;meter1.description&quot;, &quot;'AXDescription: label'&quot;);
+
+          var meter2 = accessibilityController.accessibleElementById(&quot;meter2&quot;);
+          shouldBe(&quot;meter2.description&quot;, &quot;'AXDescription: label wrapping meter'&quot;);
+          
+          var meter3 = accessibilityController.accessibleElementById(&quot;meter3&quot;);
+          shouldBe(&quot;meter3.description&quot;, &quot;'AXDescription: aria label'&quot;);
+          
+          var meter4 = accessibilityController.accessibleElementById(&quot;meter4&quot;);
+          shouldBe(&quot;meter4.description&quot;, &quot;'AXDescription: aria labelledby'&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 (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/Source/WebCore/ChangeLog        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-09-29  Nan Wang  &lt;n_wang@apple.com&gt;
+
+        AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
+        https://bugs.webkit.org/show_bug.cgi?id=162586
+
+        Reviewed by Chris Fleizach.
+
+        Exposed the label element's text as AXDescription for meter elements.
+        Also refactored the code for fetching the label element's text and taken care of 
+        the case where aria-label and aria-labelledby attributes are used on label elements. 
+
+        Test: accessibility/mac/meter-with-label-element.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isLabelable):
+        (WebCore::AccessibilityNodeObject::textForLabelElement):
+        (WebCore::AccessibilityNodeObject::titleElementText):
+        (WebCore::AccessibilityNodeObject::title):
+        (WebCore::AccessibilityNodeObject::usesAltTagForTextComputation): Deleted.
+        * accessibility/AccessibilityNodeObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
+
</ins><span class="cx"> 2016-09-29  Romain Bellessort  &lt;romain.bellessort@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         [Streams API] Improve ReadableStreamDefaultController.h/cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -1230,7 +1230,34 @@
</span><span class="cx"> {
</span><span class="cx">     return isImage() || isInputImage() || isNativeImage() || isCanvas() || (node() &amp;&amp; node()-&gt;hasTagName(imgTag));
</span><span class="cx"> }
</span><ins>+
+bool AccessibilityNodeObject::isLabelable() const
+{
+    Node* node = this-&gt;node();
+    if (!node)
+        return false;
</ins><span class="cx">     
</span><ins>+    return is&lt;HTMLInputElement&gt;(*node) || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl() || isProgressIndicator() || isMeter();
+}
+
+String AccessibilityNodeObject::textForLabelElement(Element* element) const
+{
+    String result = String();
+    if (!is&lt;HTMLLabelElement&gt;(*element))
+        return result;
+    
+    HTMLLabelElement* label = downcast&lt;HTMLLabelElement&gt;(element);
+    // Check to see if there's aria-labelledby attribute on the label element.
+    if (AccessibilityObject* labelObject = axObjectCache()-&gt;getOrCreate(label))
+        result = labelObject-&gt;ariaLabeledByAttribute();
+    
+    // Then check for aria-label attribute.
+    if (result.isEmpty())
+        result = label-&gt;attributeWithoutSynchronization(aria_labelAttr);
+    
+    return !result.isEmpty() ? result : label-&gt;innerText();
+}
+    
</ins><span class="cx"> void AccessibilityNodeObject::titleElementText(Vector&lt;AccessibilityText&gt;&amp; textOrder) const
</span><span class="cx"> {
</span><span class="cx">     Node* node = this-&gt;node();
</span><span class="lines">@@ -1237,19 +1264,14 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><span class="cx">     
</span><del>-    bool isInputTag = is&lt;HTMLInputElement&gt;(*node);
-    if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl() || isProgressIndicator()) {
</del><ins>+    if (isLabelable()) {
</ins><span class="cx">         if (HTMLLabelElement* label = labelForElement(downcast&lt;Element&gt;(node))) {
</span><span class="cx">             AccessibilityObject* labelObject = axObjectCache()-&gt;getOrCreate(label);
</span><del>-            String innerText = label-&gt;innerText();
</del><ins>+            String innerText = textForLabelElement(label);
</ins><span class="cx">             
</span><del>-            const AtomicString&amp; ariaLabel = label-&gt;attributeWithoutSynchronization(aria_labelAttr);
-            if (!ariaLabel.isEmpty())
-                innerText = ariaLabel;
-            
</del><span class="cx">             // Only use the &lt;label&gt; text if there's no ARIA override.
</span><span class="cx">             if (!innerText.isEmpty() &amp;&amp; !ariaAccessibilityDescription())
</span><del>-                textOrder.append(AccessibilityText(innerText, LabelByElementText, labelObject));
</del><ins>+                textOrder.append(AccessibilityText(innerText, isMeter() ? AlternativeText : LabelByElementText, labelObject));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1710,11 +1732,11 @@
</span><span class="cx">             return input.valueWithDefault();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl() || isProgressIndicator()) {
</del><ins>+    if (isLabelable()) {
</ins><span class="cx">         HTMLLabelElement* label = labelForElement(downcast&lt;Element&gt;(node));
</span><span class="cx">         // Use the label text as the title if 1) the title element is NOT an exposed element and 2) there's no ARIA override.
</span><span class="cx">         if (label &amp;&amp; !exposesTitleUIElement() &amp;&amp; !ariaAccessibilityDescription().length())
</span><del>-            return label-&gt;innerText();
</del><ins>+            return textForLabelElement(label);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // If this node isn't rendered, there's no inner text we can extract from a select element.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityNodeObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -183,7 +183,9 @@
</span><span class="cx">     void changeValueByStep(bool increase);
</span><span class="cx">     // This returns true if it's focusable but it's not content editable and it's not a control or ARIA control.
</span><span class="cx">     bool isGenericFocusableElement() const;
</span><ins>+    bool isLabelable() const;
</ins><span class="cx">     HTMLLabelElement* labelForElement(Element*) const;
</span><ins>+    String textForLabelElement(Element*) const;
</ins><span class="cx">     String ariaAccessibilityDescription() const;
</span><span class="cx">     void ariaLabeledByElements(Vector&lt;Element*&gt;&amp; elements) const;
</span><span class="cx">     String accessibilityDescriptionForElements(Vector&lt;Element*&gt; &amp;elements) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (206580 => 206581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2016-09-29 15:12:54 UTC (rev 206580)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2016-09-29 15:13:00 UTC (rev 206581)
</span><span class="lines">@@ -1057,12 +1057,16 @@
</span><span class="cx">     if (hasTextAlternative())
</span><span class="cx">         return false;
</span><span class="cx">     
</span><del>-    // When &lt;label&gt; element has aria-label on it, we shouldn't expose it as the titleUIElement,
-    // otherwise its inner text will be announced by a screenreader.
-    if (is&lt;HTMLInputElement&gt;(*this-&gt;node()) || AccessibilityObject::isARIAInput(ariaRoleAttribute())) {
</del><ins>+    // When &lt;label&gt; element has aria-label or aria-labelledby on it, we shouldn't expose it as the
+    // titleUIElement, otherwise its inner text will be announced by a screenreader.
+    if (isLabelable()) {
</ins><span class="cx">         if (HTMLLabelElement* label = labelForElement(downcast&lt;Element&gt;(node()))) {
</span><span class="cx">             if (!label-&gt;attributeWithoutSynchronization(aria_labelAttr).isEmpty())
</span><span class="cx">                 return false;
</span><ins>+            if (AccessibilityObject* labelObject = axObjectCache()-&gt;getOrCreate(label)) {
+                if (!labelObject-&gt;ariaLabeledByAttribute().isEmpty())
+                    return false;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>