<!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>[202063] 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/202063">202063</a></dd>
<dt>Author</dt> <dd>d_russell@apple.com</dd>
<dt>Date</dt> <dd>2016-06-14 14:28:37 -0700 (Tue, 14 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>AX: Form label text should be exposed as static text if it contains only static text
https://bugs.webkit.org/show_bug.cgi?id=158634
Reviewed by Chris Fleizach.
Use AccessibilityLabel to represent HTMLLabelElement to assistive technology.
AccessibilityLabel::containsOnlyStaticText() searches label subtree to evaluate
if all children are static text.
AccessibilityLabel::stringValue() consults containsOnlyStaticText() and returns
textUnderElement() if true.
WebAccessibilityObjectWrapperMac consults containsOnlyStaticText() and substitutes
StaticTextRole for LabelRole if true.
Cache containsOnlyStaticText() in the common case when updating children.
Source/WebCore:
Tests: accessibility/mac/label-element-all-text-string-value.html
accessibility/mac/label-element-with-link-string-value.html
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer):
* accessibility/AccessibilityAllInOne.cpp:
* accessibility/AccessibilityLabel.cpp: Added.
(WebCore::AccessibilityLabel::AccessibilityLabel):
(WebCore::AccessibilityLabel::~AccessibilityLabel):
(WebCore::AccessibilityLabel::create):
(WebCore::AccessibilityLabel::computeAccessibilityIsIgnored):
(WebCore::AccessibilityLabel::stringValue):
(WebCore::childrenContainOnlyStaticText):
(WebCore::AccessibilityLabel::containsOnlyStaticText):
(WebCore::AccessibilityLabel::updateChildrenIfNecessary):
(WebCore::AccessibilityLabel::clearChildren):
(WebCore::AccessibilityLabel::insertChild):
* accessibility/AccessibilityLabel.h: Added.
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isLabel):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper role]):
LayoutTests:
* accessibility/aria-labelledby-overrides-label-expected.txt:
* accessibility/mac/label-element-all-text-string-value-expected.txt: Added.
* accessibility/mac/label-element-all-text-string-value.html: Added.
* accessibility/mac/label-element-with-hidden-control-expected.txt:
* accessibility/mac/label-element-with-hidden-control.html:
* accessibility/mac/label-element-with-link-string-value-expected.txt: Added.
* accessibility/mac/label-element-with-link-string-value.html: Added.
* accessibility/mac/slider-allows-title-ui-element-expected.txt:
* accessibility/mac/slider-allows-title-ui-element.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityarialabelledbyoverrideslabelexpectedtxt">trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementwithhiddencontrolexpectedtxt">trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementwithhiddencontrolhtml">trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacsliderallowstitleuielementexpectedtxt">trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacsliderallowstitleuielementhtml">trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element.html</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityAllInOnecpp">trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementalltextstringvalueexpectedtxt">trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementalltextstringvaluehtml">trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementchangingchildrenstringvalueexpectedtxt">trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementchangingchildrenstringvaluehtml">trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementchangingtextcontentstringvalueexpectedtxt">trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementchangingtextcontentstringvaluehtml">trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementwithlinkstringvalueexpectedtxt">trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymaclabelelementwithlinkstringvaluehtml">trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value.html</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityLabelcpp">trunk/Source/WebCore/accessibility/AccessibilityLabel.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityLabelh">trunk/Source/WebCore/accessibility/AccessibilityLabel.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/ChangeLog        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-06-14 Doug Russell <d_russell@apple.com>
+
+ AX: Form label text should be exposed as static text if it contains only static text
+ https://bugs.webkit.org/show_bug.cgi?id=158634
+
+ Reviewed by Chris Fleizach.
+
+ Use AccessibilityLabel to represent HTMLLabelElement to assistive technology.
+ AccessibilityLabel::containsOnlyStaticText() searches label subtree to evaluate
+ if all children are static text.
+ AccessibilityLabel::stringValue() consults containsOnlyStaticText() and returns
+ textUnderElement() if true.
+ WebAccessibilityObjectWrapperMac consults containsOnlyStaticText() and substitutes
+ StaticTextRole for LabelRole if true.
+ Cache containsOnlyStaticText() in the common case when updating children.
+
+ * accessibility/aria-labelledby-overrides-label-expected.txt:
+ * accessibility/mac/label-element-all-text-string-value-expected.txt: Added.
+ * accessibility/mac/label-element-all-text-string-value.html: Added.
+ * accessibility/mac/label-element-with-hidden-control-expected.txt:
+ * accessibility/mac/label-element-with-hidden-control.html:
+ * accessibility/mac/label-element-with-link-string-value-expected.txt: Added.
+ * accessibility/mac/label-element-with-link-string-value.html: Added.
+ * accessibility/mac/slider-allows-title-ui-element-expected.txt:
+ * accessibility/mac/slider-allows-title-ui-element.html:
+
</ins><span class="cx"> 2016-06-14 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Increase timeouts for userscripts/window-onerror-for-isolated-world-3.html to fix flakiness.
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityarialabelledbyoverrideslabelexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">
</span><span class="cx"> PASS platformValueForW3CName(text) is "Shut down computer after 10 minutes"
</span><span class="cx"> PASS text.titleUIElement() != null && text.titleUIElement().isValid is false
</span><del>-Label element role is: AXRole: AXGroup
</del><ins>+Label element role is: AXRole: AXStaticText
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementalltextstringvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value-expected.txt (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+ first choice
+This tests that if a label element contains text children it's AXValue will be their concatenated AXValues.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS label.role is 'AXRole: AXStaticText'
+PASS label.stringValue is 'AXValue: first choice'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementalltextstringvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value.html (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value.html         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-all-text-string-value.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="radio" id="input" />
+<label for="input" id="label">
+ <span>first</span>
+ <span>choice</span>
+</label>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ var label = 0;
+
+ description("This tests that if a label element contains text children it's AXValue will be their concatenated AXValues.");
+ if (window.accessibilityController) {
+
+ if (window.accessibilityController) {
+
+ var body = document.getElementById("body");
+ body.focus();
+
+ label = accessibilityController.accessibleElementById("label");
+ shouldBe("label.role", "'AXRole: AXStaticText'");
+ shouldBe("label.stringValue", "'AXValue: first choice'");
+ }
+ }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementchangingchildrenstringvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+ firstfoo choice
+This tests that if a label element's children change, the string value updates
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS label.role is 'AXRole: AXStaticText'
+PASS initialStringValue is 'AXValue: first choice'
+PASS mutatedStringValue is 'AXValue: first foo choice'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementchangingchildrenstringvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value.html (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value.html         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="radio" id="input" />
+<label for="input" id="label">
+ <span id="first">first</span>
+ <span>choice</span>
+</label>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ var label = 0;
+ var initialStringValue = 0;
+ var mutatedStringValue = 0;
+
+ description("This tests that if a label element's children change, the string value updates");
+ if (window.accessibilityController) {
+
+ if (window.accessibilityController) {
+
+ var body = document.getElementById("body");
+ body.focus();
+
+ label = accessibilityController.accessibleElementById("label");
+ initialStringValue = label.stringValue;
+ var first = document.getElementById("first")
+ var element = document.createElement("span");
+ var foo = document.createTextNode("foo");
+ element.appendChild(foo);
+ first.appendChild(foo);
+ mutatedStringValue = label.stringValue;
+
+ shouldBe("label.role", "'AXRole: AXStaticText'");
+ shouldBe("initialStringValue", "'AXValue: first choice'");
+ shouldBe("mutatedStringValue", "'AXValue: first foo choice'");
+ }
+ }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementchangingtextcontentstringvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value-expected.txt (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+ second choice
+This tests that if a label element's children's textContent changes, the string value updates
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS label.role is 'AXRole: AXStaticText'
+PASS initialStringValue is 'AXValue: first choice'
+PASS mutatedStringValue is 'AXValue: second choice'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementchangingtextcontentstringvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value.html (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value.html         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="radio" id="input" />
+<label for="input" id="label">
+ <span id="first">first</span>
+ <span>choice</span>
+</label>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ var label = 0;
+ var initialStringValue = 0;
+ var mutatedStringValue = 0;
+
+ description("This tests that if a label element's children's textContent changes, the string value updates");
+ if (window.accessibilityController) {
+
+ if (window.accessibilityController) {
+
+ var body = document.getElementById("body");
+ body.focus();
+
+ label = accessibilityController.accessibleElementById("label");
+ initialStringValue = label.stringValue;
+ var first = document.getElementById("first")
+ first.textContent = "second";
+ mutatedStringValue = label.stringValue;
+
+ shouldBe("label.role", "'AXRole: AXStaticText'");
+ shouldBe("initialStringValue", "'AXValue: first choice'");
+ shouldBe("mutatedStringValue", "'AXValue: second choice'");
+ }
+ }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementwithhiddencontrolexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control-expected.txt (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control-expected.txt        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS container.childAtIndex('0').role is 'AXRole: AXGroup'
</del><ins>+PASS container.childAtIndex('0').role is 'AXRole: AXStaticText'
</ins><span class="cx"> PASS container.childAtIndex('0').childAtIndex(0).role is 'AXRole: AXStaticText'
</span><span class="cx"> PASS container.childAtIndex('0').childAtIndex(0).stringValue is 'AXValue: Test label1'
</span><span class="cx"> PASS container.childAtIndex('2').role is 'AXRole: AXCheckBox'
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementwithhiddencontrolhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control.html (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control.html        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/accessibility/mac/label-element-with-hidden-control.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx"> var body = document.getElementById("body");
</span><span class="cx"> body.focus();
</span><span class="cx"> var container = accessibilityController.focusedElement.childAtIndex(0);
</span><del>- shouldBe("container.childAtIndex('0').role", "'AXRole: AXGroup'");
</del><ins>+ shouldBe("container.childAtIndex('0').role", "'AXRole: AXStaticText'");
</ins><span class="cx"> shouldBe("container.childAtIndex('0').childAtIndex(0).role", "'AXRole: AXStaticText'");
</span><span class="cx"> shouldBe("container.childAtIndex('0').childAtIndex(0).stringValue", "'AXValue: Test label1'");
</span><span class="cx"> shouldBe("container.childAtIndex('2').role", "'AXRole: AXCheckBox'");
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementwithlinkstringvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value-expected.txt (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value-expected.txt         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+ first choice
+This tests that if a label element contains a link it will be exposed as a group with no AXValue.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS label.role is 'AXRole: AXGroup'
+PASS label.stringValue is 'AXValue: '
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymaclabelelementwithlinkstringvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value.html (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value.html         (rev 0)
+++ trunk/LayoutTests/accessibility/mac/label-element-with-link-string-value.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<input type="radio" id="input" />
+<label for="input" id="label">
+        <span>first</span>
+        <span><a href="">choice</a></span>
+</label>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+        var label = 0;
+
+ description("This tests that if a label element contains a link it will be exposed as a group with no AXValue.");
+ if (window.accessibilityController) {
+
+ if (window.accessibilityController) {
+
+ var body = document.getElementById("body");
+ body.focus();
+
+ label = accessibilityController.accessibleElementById("label");
+ shouldBe("label.role", "'AXRole: AXGroup'");
+ shouldBe("label.stringValue", "'AXValue: '");
+ }
+ }
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacsliderallowstitleuielementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element-expected.txt (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element-expected.txt        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element-expected.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> PASS slider.titleUIElement().isEqual(title) is true
</span><del>-PASS title.role is 'AXRole: AXGroup'
</del><ins>+PASS title.role is 'AXRole: AXStaticText'
</ins><span class="cx"> PASS title.childAtIndex(0).role is 'AXRole: AXStaticText'
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacsliderallowstitleuielementhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element.html (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element.html        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/LayoutTests/accessibility/mac/slider-allows-title-ui-element.html        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx"> var title = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0).childAtIndex(0);
</span><span class="cx">
</span><span class="cx"> shouldBeTrue("slider.titleUIElement().isEqual(title)");
</span><del>- shouldBe("title.role", "'AXRole: AXGroup'");
</del><ins>+ shouldBe("title.role", "'AXRole: AXStaticText'");
</ins><span class="cx"> shouldBe("title.childAtIndex(0).role", "'AXRole: AXStaticText'");
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -1050,6 +1050,7 @@
</span><span class="cx"> accessibility/AccessibilityARIAGridRow.cpp
</span><span class="cx"> accessibility/AccessibilityAttachment.cpp
</span><span class="cx"> accessibility/AccessibilityImageMapLink.cpp
</span><ins>+ accessibility/AccessibilityLabel.cpp
</ins><span class="cx"> accessibility/AccessibilityList.cpp
</span><span class="cx"> accessibility/AccessibilityListBox.cpp
</span><span class="cx"> accessibility/AccessibilityListBoxOption.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/ChangeLog        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-06-14 Doug Russell <d_russell@apple.com>
+
+ AX: Form label text should be exposed as static text if it contains only static text
+ https://bugs.webkit.org/show_bug.cgi?id=158634
+
+ Reviewed by Chris Fleizach.
+
+ Use AccessibilityLabel to represent HTMLLabelElement to assistive technology.
+ AccessibilityLabel::containsOnlyStaticText() searches label subtree to evaluate
+ if all children are static text.
+ AccessibilityLabel::stringValue() consults containsOnlyStaticText() and returns
+ textUnderElement() if true.
+ WebAccessibilityObjectWrapperMac consults containsOnlyStaticText() and substitutes
+ StaticTextRole for LabelRole if true.
+ Cache containsOnlyStaticText() in the common case when updating children.
+
+ Tests: accessibility/mac/label-element-all-text-string-value.html
+ accessibility/mac/label-element-with-link-string-value.html
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::createFromRenderer):
+ * accessibility/AccessibilityAllInOne.cpp:
+ * accessibility/AccessibilityLabel.cpp: Added.
+ (WebCore::AccessibilityLabel::AccessibilityLabel):
+ (WebCore::AccessibilityLabel::~AccessibilityLabel):
+ (WebCore::AccessibilityLabel::create):
+ (WebCore::AccessibilityLabel::computeAccessibilityIsIgnored):
+ (WebCore::AccessibilityLabel::stringValue):
+ (WebCore::childrenContainOnlyStaticText):
+ (WebCore::AccessibilityLabel::containsOnlyStaticText):
+ (WebCore::AccessibilityLabel::updateChildrenIfNecessary):
+ (WebCore::AccessibilityLabel::clearChildren):
+ (WebCore::AccessibilityLabel::insertChild):
+ * accessibility/AccessibilityLabel.h: Added.
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::isLabel):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper role]):
+
</ins><span class="cx"> 2016-06-14 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r202057.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -6775,6 +6775,7 @@
</span><span class="cx">                 F50664F7157F52DC00AC226F /* FormController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50664F5157F52DC00AC226F /* FormController.cpp */; };
</span><span class="cx">                 F50664F8157F52DC00AC226F /* FormController.h in Headers */ = {isa = PBXBuildFile; fileRef = F50664F6157F52DC00AC226F /* FormController.h */; };
</span><span class="cx">                 F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F513A3E915FF4841001526DB /* ValidationMessageClient.h */; };
</span><ins>+                F52A8FD71D0A8D0E0073CF42 /* AccessibilityLabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52A8FD51D0A88010073CF42 /* AccessibilityLabel.cpp */; };
</ins><span class="cx">                 F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; };
</span><span class="cx">                 F544F78815CFB2A800AF33A8 /* PlatformLocale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */; };
</span><span class="cx">                 F544F78915CFB2A800AF33A8 /* PlatformLocale.h in Headers */ = {isa = PBXBuildFile; fileRef = F544F78715CFB2A800AF33A8 /* PlatformLocale.h */; };
</span><span class="lines">@@ -14871,6 +14872,8 @@
</span><span class="cx">                 F523D27902DE43D7018635CA /* TextResourceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextResourceDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><ins>+                F52A8FD51D0A88010073CF42 /* AccessibilityLabel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityLabel.cpp; sourceTree = "<group>"; };
+                F52A8FD61D0A88010073CF42 /* AccessibilityLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityLabel.h; sourceTree = "<group>"; };
</ins><span class="cx">                 F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmptyClients.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformLocale.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 F544F78715CFB2A800AF33A8 /* PlatformLocale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLocale.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -16520,6 +16523,8 @@
</span><span class="cx">                                 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */,
</span><span class="cx">                                 2981CAA0131822EC00D12F2A /* AccessibilityImageMapLink.cpp */,
</span><span class="cx">                                 29A8121D0FBB9C1D00510293 /* AccessibilityImageMapLink.h */,
</span><ins>+                                F52A8FD51D0A88010073CF42 /* AccessibilityLabel.cpp */,
+                                F52A8FD61D0A88010073CF42 /* AccessibilityLabel.h */,
</ins><span class="cx">                                 2981CAA1131822EC00D12F2A /* AccessibilityList.cpp */,
</span><span class="cx">                                 29A8120E0FBB9C1D00510293 /* AccessibilityList.h */,
</span><span class="cx">                                 2981CAA2131822EC00D12F2A /* AccessibilityListBox.cpp */,
</span><span class="lines">@@ -29777,6 +29782,7 @@
</span><span class="cx">                                 FE6938B61045D67E008EABB6 /* EventHandlerIOS.mm in Sources */,
</span><span class="cx">                                 93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,
</span><span class="cx">                                 AD4495F3141FC08900541EDF /* EventListenerMap.cpp in Sources */,
</span><ins>+                                F52A8FD71D0A8D0E0073CF42 /* AccessibilityLabel.cpp in Sources */,
</ins><span class="cx">                                 C400D10918F1C8F60090D863 /* EventLoopInput.cpp in Sources */,
</span><span class="cx">                                 99CC0B5018BE9849006CEBCC /* EventLoopInputDispatcher.cpp in Sources */,
</span><span class="cx">                                 26F40D4A14904A6300CA67C4 /* EventLoopIOS.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include "AccessibilityARIAGridRow.h"
</span><span class="cx"> #include "AccessibilityAttachment.h"
</span><span class="cx"> #include "AccessibilityImageMapLink.h"
</span><ins>+#include "AccessibilityLabel.h"
</ins><span class="cx"> #include "AccessibilityList.h"
</span><span class="cx"> #include "AccessibilityListBox.h"
</span><span class="cx"> #include "AccessibilityListBoxOption.h"
</span><span class="lines">@@ -428,6 +429,9 @@
</span><span class="cx"> if (nodeHasRole(node, "treeitem"))
</span><span class="cx"> return AccessibilityTreeItem::create(renderer);
</span><span class="cx">
</span><ins>+ if (node && is<HTMLLabelElement>(node))
+ return AccessibilityLabel::create(renderer);
+
</ins><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> // media controls
</span><span class="cx"> if (node && node->isMediaControlElement())
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "AccessibilityARIAGridRow.cpp"
</span><span class="cx"> #include "AccessibilityAttachment.cpp"
</span><span class="cx"> #include "AccessibilityImageMapLink.cpp"
</span><ins>+#include "AccessibilityLabel.cpp"
</ins><span class="cx"> #include "AccessibilityList.cpp"
</span><span class="cx"> #include "AccessibilityListBox.cpp"
</span><span class="cx"> #include "AccessibilityListBoxOption.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityLabelcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/accessibility/AccessibilityLabel.cpp (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityLabel.cpp         (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityLabel.cpp        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AccessibilityLabel.h"
+
+#include "AXObjectCache.h"
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+AccessibilityLabel::AccessibilityLabel(RenderObject* renderer)
+ : AccessibilityRenderObject(renderer)
+{
+}
+
+AccessibilityLabel::~AccessibilityLabel()
+{
+}
+
+Ref<AccessibilityLabel> AccessibilityLabel::create(RenderObject* renderer)
+{
+ return adoptRef(*new AccessibilityLabel(renderer));
+}
+
+bool AccessibilityLabel::computeAccessibilityIsIgnored() const
+{
+ return accessibilityIsIgnoredByDefault();
+}
+
+String AccessibilityLabel::stringValue() const
+{
+ if (containsOnlyStaticText())
+ return textUnderElement();
+ return AccessibilityNodeObject::stringValue();
+}
+
+static bool childrenContainOnlyStaticText(const AccessibilityObject::AccessibilityChildrenVector& children)
+{
+ if (!children.size())
+ return false;
+ for (const auto& child : children) {
+ if (child->roleValue() == StaticTextRole)
+ continue;
+ if (child->roleValue() == GroupRole) {
+ if (!childrenContainOnlyStaticText(child->children()))
+ return false;
+ } else
+ return false;
+ }
+ return true;
+}
+
+bool AccessibilityLabel::containsOnlyStaticText() const
+{
+ if (m_containsOnlyStaticTextDirty)
+ return childrenContainOnlyStaticText(m_children);
+ return m_containsOnlyStaticText;
+}
+
+void AccessibilityLabel::updateChildrenIfNecessary()
+{
+ AccessibilityRenderObject::updateChildrenIfNecessary();
+ if (m_containsOnlyStaticTextDirty)
+ m_containsOnlyStaticText = childrenContainOnlyStaticText(m_children);
+ m_containsOnlyStaticTextDirty = false;
+}
+
+void AccessibilityLabel::clearChildren()
+{
+ AccessibilityRenderObject::clearChildren();
+ m_containsOnlyStaticText = false;
+ m_containsOnlyStaticTextDirty = false;
+}
+
+void AccessibilityLabel::insertChild(AccessibilityObject* object, unsigned index)
+{
+ AccessibilityRenderObject::insertChild(object, index);
+ m_containsOnlyStaticTextDirty = true;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityLabelh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/accessibility/AccessibilityLabel.h (0 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityLabel.h         (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityLabel.h        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityLabel_h
+#define AccessibilityLabel_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+
+class AccessibilityLabel final : public AccessibilityRenderObject {
+public:
+ static Ref<AccessibilityLabel> create(RenderObject*);
+ virtual ~AccessibilityLabel();
+
+ bool containsOnlyStaticText() const;
+
+private:
+ explicit AccessibilityLabel(RenderObject*);
+ bool computeAccessibilityIsIgnored() const final;
+ AccessibilityRole roleValue() const final { return LabelRole; }
+ bool isLabel() const final { return true; }
+ String stringValue() const final;
+ void updateChildrenIfNecessary() final;
+ void clearChildren() final;
+ void insertChild(AccessibilityObject*, unsigned) final;
+ bool m_containsOnlyStaticTextDirty : 1;
+ bool m_containsOnlyStaticText : 1;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityLabel, isLabel())
+
+#endif // AccessibilityLabel_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -512,6 +512,7 @@
</span><span class="cx"> virtual bool isSliderThumb() const { return false; }
</span><span class="cx"> virtual bool isInputSlider() const { return false; }
</span><span class="cx"> virtual bool isControl() const { return false; }
</span><ins>+ virtual bool isLabel() const { return false; }
</ins><span class="cx"> virtual bool isList() const { return false; }
</span><span class="cx"> virtual bool isTable() const { return false; }
</span><span class="cx"> virtual bool isDataTable() const { return false; }
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (202062 => 202063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2016-06-14 21:27:19 UTC (rev 202062)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2016-06-14 21:28:37 UTC (rev 202063)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx">
</span><span class="cx"> #import "AXObjectCache.h"
</span><span class="cx"> #import "AccessibilityARIAGridRow.h"
</span><ins>+#import "AccessibilityLabel.h"
</ins><span class="cx"> #import "AccessibilityList.h"
</span><span class="cx"> #import "AccessibilityListBox.h"
</span><span class="cx"> #import "AccessibilityRenderObject.h"
</span><span class="lines">@@ -2232,6 +2233,10 @@
</span><span class="cx"> return [[self attachmentView] accessibilityAttributeValue:NSAccessibilityRoleAttribute];
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> AccessibilityRole role = m_object->roleValue();
</span><ins>+
+ if (role == LabelRole && is<AccessibilityLabel>(*m_object) && downcast<AccessibilityLabel>(*m_object).containsOnlyStaticText())
+ role = StaticTextRole;
+
</ins><span class="cx"> if (role == CanvasRole && m_object->canvasHasFallbackContent())
</span><span class="cx"> role = GroupRole;
</span><span class="cx"> NSString* string = roleValueToNSString(role);
</span></span></pre>
</div>
</div>
</body>
</html>