<!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>[180718] 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/180718">180718</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-26 17:57:48 -0800 (Thu, 26 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Expose caret browsing preference to accessibility API
https://bugs.webkit.org/show_bug.cgi?id=141862

Patch by Doug Russell &lt;d_russell@apple.com&gt; on 2015-02-26
Reviewed by Chris Fleizach.

Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.

Source/WebCore:

Tests: platform/mac/accessibility/caret-browsing-arrow-nav.html
       platform/mac/accessibility/caret-browsing-attribute.html
       platform/mac/accessibility/caret-browsing-tab-selection.html

* accessibility/AccessibilityObject.h:
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::caretBrowsingEnabled):
(WebCore::AccessibilityObject::setCaretBrowsingEnabled):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
(-[WebAccessibilityObjectWrapper _accessibilitySetTestValue:forAttribute:]):

Tools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(setBoolAttributeValueCallback):
(selectedTextMarkerRangeCallback):
(resetSelectedTextMarkerRangeCallback):
(AccessibilityUIElement::setBoolAttributeValue):
(AccessibilityUIElement::selectedTextMarkerRange):
(AccessibilityUIElement::resetSelectedTextMarkerRange):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::setBoolAttributeValue):
(AccessibilityUIElement::selectedTextMarkerRange):
(AccessibilityUIElement::resetSelectedTextMarkerRange):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::selectedTextMarkerRange):
(WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
(WTR::AccessibilityUIElement::setBoolAttributeValue):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setBoolAttributeValue):
(WTR::AccessibilityUIElement::selectedTextMarkerRange):
(WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):

LayoutTests:

* accessibility/parent-delete-expected.txt:
* platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt: Added.
* platform/mac/accessibility/caret-browsing-arrow-nav.html: Added.
* platform/mac/accessibility/caret-browsing-attribute-expected.txt: Added.
* platform/mac/accessibility/caret-browsing-attribute.html: Added.
* platform/mac/accessibility/caret-browsing-tab-selection-expected.txt: Added.
* platform/mac/accessibility/caret-browsing-tab-selection.html: Added.
* platform/mac/accessibility/document-attributes-expected.txt:
* platform/mac/accessibility/resources/accessibility-helper.js: Added.
(clearSelectionAndFocusOnWebArea):
(elementAtStartMarkerOfSelectedTextMarkerRange):
(caretBrowsingEnabled):
(setCaretBrowsingEnabled):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityparentdeleteexpectedtxt">trunk/LayoutTests/accessibility/parent-delete-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitydocumentattributesexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacAccessibilityObjectMacmm">trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementcpp">trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementh">trunk/Tools/DumpRenderTree/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm">trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingarrownavexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingarrownavhtml">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingattributeexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingattributehtml">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingtabselectionexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitycaretbrowsingtabselectionhtml">trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityresourcesaccessibilityhelperjs">trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-02-26  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Expose caret browsing preference to accessibility API
+        https://bugs.webkit.org/show_bug.cgi?id=141862
+
+        Reviewed by Chris Fleizach.
+
+        Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+        Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+        * accessibility/parent-delete-expected.txt:
+        * platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt: Added.
+        * platform/mac/accessibility/caret-browsing-arrow-nav.html: Added.
+        * platform/mac/accessibility/caret-browsing-attribute-expected.txt: Added.
+        * platform/mac/accessibility/caret-browsing-attribute.html: Added.
+        * platform/mac/accessibility/caret-browsing-tab-selection-expected.txt: Added.
+        * platform/mac/accessibility/caret-browsing-tab-selection.html: Added.
+        * platform/mac/accessibility/document-attributes-expected.txt:
+        * platform/mac/accessibility/resources/accessibility-helper.js: Added.
+        (clearSelectionAndFocusOnWebArea):
+        (elementAtStartMarkerOfSelectedTextMarkerRange):
+        (caretBrowsingEnabled):
+        (setCaretBrowsingEnabled):
+
</ins><span class="cx"> 2015-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Save Console Evaluations into Command Line variables $1-$99 ($n)
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityparentdeleteexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/parent-delete-expected.txt (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/parent-delete-expected.txt        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/accessibility/parent-delete-expected.txt        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -27,5 +27,6 @@
</span><span class="cx"> AXLayoutCount: 2
</span><span class="cx"> AXLoadingProgress: 1
</span><span class="cx"> AXURL: LayoutTests/accessibility/parent-delete.html
</span><ins>+AXCaretBrowsingEnabled: 0
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingarrownavexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav-expected.txt        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+Foo
+Bar
+Baz
+This tests caret browsing when a keydown handler moves focus.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS caretBrowsingEnabled(webArea) is false
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Baz'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS caretBrowsingEnabled(webArea) is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: Bar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingarrownavhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-arrow-nav.html        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,84 @@
</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;script src=&quot;resources/accessibility-helper.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot; onkeydown=&quot;keydown(event)&quot;&gt;
+    &lt;script&gt;
+        function keydown(event) {
+            var key = event.keyCode;
+            var currentId = parseInt(document.activeElement.id);
+            if (isNaN(currentId)) { currentId = 0; }
+            if (key == 39) { currentId++; }
+            if (currentId &lt; 1) { currentId = 3; } 
+            else if (currentId &gt; 3) { currentId = 1; }
+            document.getElementById(currentId).focus();
+        }
+    &lt;/script&gt;
+    &lt;div&gt;
+        &lt;ul&gt;
+            &lt;li&gt;&lt;a id=&quot;1&quot; href=&quot;&quot;&gt;Foo&lt;/a&gt;&lt;/li&gt;
+            &lt;li&gt;&lt;a id=&quot;2&quot; href=&quot;&quot;&gt;Bar&lt;/a&gt;&lt;/li&gt;
+            &lt;li&gt;&lt;a id=&quot;3&quot; href=&quot;&quot;&gt;Baz&lt;/a&gt;&lt;/li&gt;
+        &lt;/ul&gt;
+    &lt;/div&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;script&gt;
+    description(&quot;This tests caret browsing when a keydown handler moves focus.&quot;);
+    if (window.testRunner) {
+
+        testRunner.dumpAsText();
+
+        if (window.accessibilityController &amp;&amp; window.eventSender) {
+
+            var webArea = clearSelectionAndFocusOnWebArea();
+
+            // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+            accessibilityController.enableEnhancedAccessibility(true);
+            shouldBe(&quot;accessibilityController.enhancedAccessibilityEnabled&quot;, &quot;true&quot;);
+
+            // Focus into first link
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+
+            // Navigating with arrows, without caret browsing, will pull selection into the different links
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Bar'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Baz'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+
+            // Do it again with caret browsing on
+            setCaretBrowsingEnabled(webArea, true);
+            shouldBe(&quot;caretBrowsingEnabled(webArea)&quot;, &quot;true&quot;);
+
+            // Arrow to the start of Foo
+            eventSender.keyDown(&quot;leftArrow&quot;);
+            eventSender.keyDown(&quot;leftArrow&quot;);
+            eventSender.keyDown(&quot;leftArrow&quot;);
+
+            // Navigating with arrows, with caret browsing, will move the caret through the characters of the element before moving to the next element
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Bar'&quot;);
+
+            // Up &amp; down arrows should move through the list items
+            eventSender.keyDown(&quot;upArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Foo'&quot;);
+            eventSender.keyDown(&quot;downArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: Bar'&quot;);
+
+            setCaretBrowsingEnabled(webArea, false);
+        }
+    }
+    &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="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingattributeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute-expected.txt        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+This tests setting caret browsing preference via ax api.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS caretBrowsingEnabled(webArea) is true
+PASS caretBrowsingEnabled(webArea) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingattributehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-attribute.html        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,28 @@
</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;script src=&quot;resources/accessibility-helper.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+&lt;script&gt;
+description(&quot;This tests setting caret browsing preference via ax api.&quot;);
+if (window.testRunner) {
+
+  testRunner.dumpAsText();
+
+  if (window.accessibilityController) {
+
+    var webArea = accessibilityController.rootElement.childAtIndex(0);
+
+    setCaretBrowsingEnabled(webArea, true);
+    shouldBe(&quot;caretBrowsingEnabled(webArea)&quot;, &quot;true&quot;);
+
+    setCaretBrowsingEnabled(webArea, false);
+    shouldBe(&quot;caretBrowsingEnabled(webArea)&quot;, &quot;false&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 class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingtabselectionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection-expected.txt        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+foo
+A paragraph with a single line
+
+bar
+This tests caret browsing for html select elements.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS caretBrowsingEnabled(webArea) is false
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS caretBrowsingEnabled(webArea) is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: foo'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: bar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitycaretbrowsingtabselectionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/caret-browsing-tab-selection.html        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,49 @@
</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;script src=&quot;resources/accessibility-helper.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+    &lt;a href=&quot;&quot;&gt;foo&lt;/a&gt;
+    &lt;p id=&quot;par1&quot;&gt;A paragraph with a single line&lt;/p&gt;
+    &lt;a href=&quot;&quot;&gt;bar&lt;/a&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;script&gt;
+    description(&quot;This tests caret browsing for html select elements.&quot;);
+    if (window.testRunner) {
+
+        testRunner.overridePreference(&quot;WebKitTabToLinksPreferenceKey&quot;, 1);
+        testRunner.dumpAsText();
+
+        if (window.accessibilityController &amp;&amp; window.eventSender) {
+
+            var webArea = clearSelectionAndFocusOnWebArea();
+
+            accessibilityController.enableEnhancedAccessibility(false);
+
+            // Tab (should NOT move selection before enhanced accessibility is enabled).
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: foo'&quot;);
+            eventSender.keyDown(&quot;\t&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: foo'&quot;);
+
+            // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+            accessibilityController.enableEnhancedAccessibility(true);
+            shouldBe(&quot;accessibilityController.enhancedAccessibilityEnabled&quot;, &quot;true&quot;);
+
+            // Enable caret browsing so that tabbing will modify selection
+            setCaretBrowsingEnabled(webArea, true);
+            shouldBe(&quot;caretBrowsingEnabled(webArea)&quot;, &quot;true&quot;);
+
+            // Tab to move focus to next link
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: foo'&quot;);
+            eventSender.keyDown(&quot;\t&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: bar'&quot;);
+
+            setCaretBrowsingEnabled(webArea, false);
+        }
+    }
+    &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="trunkLayoutTestsplatformmacaccessibilitydocumentattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> AXLayoutCount: 2
</span><span class="cx"> AXLoadingProgress: 1
</span><span class="cx"> AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html
</span><ins>+AXCaretBrowsingEnabled: 0
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityresourcesaccessibilityhelperjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js (0 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/resources/accessibility-helper.js        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+function clearSelectionAndFocusOnWebArea() {
+    webArea = accessibilityController.rootElement.childAtIndex(0);
+    webArea.resetSelectedTextMarkerRange();
+    setCaretBrowsingEnabled(webArea, false);
+    shouldBe(&quot;webArea.role&quot;, &quot;'AXRole: AXWebArea'&quot;);
+    shouldBe(&quot;caretBrowsingEnabled(webArea)&quot;, &quot;false&quot;);
+    return webArea;
+}
+
+function elementAtStartMarkerOfSelectedTextMarkerRange(webArea) {
+    var range = webArea.selectedTextMarkerRange();
+    var start = webArea.startTextMarkerForTextMarkerRange(range);
+    var element = webArea.accessibilityElementForTextMarker(start);
+    return element;
+}
+
+function caretBrowsingEnabled(webArea) {
+    return webArea.boolAttributeValue(&quot;AXCaretBrowsingEnabled&quot;);
+}
+
+function setCaretBrowsingEnabled(webArea, value) {
+    webArea.setBoolAttributeValue(&quot;AXCaretBrowsingEnabled&quot;, value);
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2015-02-26  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Expose caret browsing preference to accessibility API
+        https://bugs.webkit.org/show_bug.cgi?id=141862
+
+        Reviewed by Chris Fleizach.
+
+        Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+        Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+        Tests: platform/mac/accessibility/caret-browsing-arrow-nav.html
+               platform/mac/accessibility/caret-browsing-attribute.html
+               platform/mac/accessibility/caret-browsing-tab-selection.html
+
+        * accessibility/AccessibilityObject.h:
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::caretBrowsingEnabled):
+        (WebCore::AccessibilityObject::setCaretBrowsingEnabled):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySetTestValue:forAttribute:]):
+
</ins><span class="cx"> 2015-02-26  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unnecessary create() factory functions
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -978,6 +978,11 @@
</span><span class="cx">     // other operations update type operations
</span><span class="cx">     void updateBackingStore();
</span><span class="cx">     
</span><ins>+#if PLATFORM(COCOA) &amp;&amp; !PLATFORM(IOS)
+    bool caretBrowsingEnabled() const;
+    void setCaretBrowsingEnabled(bool);
+#endif
+    
</ins><span class="cx"> protected:
</span><span class="cx">     AXID m_id;
</span><span class="cx">     AccessibilityChildrenVector m_children;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacAccessibilityObjectMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #import &quot;ElementAncestorIterator.h&quot;
</span><span class="cx"> #import &quot;HTMLFieldSetElement.h&quot;
</span><span class="cx"> #import &quot;RenderObject.h&quot;
</span><ins>+#import &quot;Settings.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if HAVE(ACCESSIBILITY)
</span><span class="cx"> 
</span><span class="lines">@@ -106,6 +107,20 @@
</span><span class="cx">     return DefaultBehavior;
</span><span class="cx"> }
</span><span class="cx">     
</span><ins>+bool AccessibilityObject::caretBrowsingEnabled() const
+{
+    Frame* frame = this-&gt;frame();
+    return frame &amp;&amp; frame-&gt;settings().caretBrowsingEnabled();
+}
+
+void AccessibilityObject::setCaretBrowsingEnabled(bool on)
+{
+    Frame* frame = this-&gt;frame();
+    if (!frame)
+        return;
+    frame-&gt;settings().setCaretBrowsingEnabled(on);
+}
+
</ins><span class="cx"> } // WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // HAVE(ACCESSIBILITY)
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -464,6 +464,10 @@
</span><span class="cx"> #define NSAccessibilityMathPrescriptsAttribute @&quot;AXMathPrescripts&quot;
</span><span class="cx"> #define NSAccessibilityMathPostscriptsAttribute @&quot;AXMathPostscripts&quot;
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilityCaretBrowsingEnabledAttribute
+#define NSAccessibilityCaretBrowsingEnabledAttribute @&quot;AXCaretBrowsingEnabled&quot;
+#endif
+
</ins><span class="cx"> @implementation WebAccessibilityObjectWrapper
</span><span class="cx"> 
</span><span class="cx"> - (void)unregisterUniqueIdForUIElement
</span><span class="lines">@@ -1354,6 +1358,7 @@
</span><span class="cx">         [tempArray addObject:@&quot;AXLayoutCount&quot;];
</span><span class="cx">         [tempArray addObject:NSAccessibilityLoadingProgressAttribute];
</span><span class="cx">         [tempArray addObject:NSAccessibilityURLAttribute];
</span><ins>+        [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute];
</ins><span class="cx">         webAreaAttrs = [[NSArray alloc] initWithArray:tempArray];
</span><span class="cx">         [tempArray release];
</span><span class="cx">     }
</span><span class="lines">@@ -2953,6 +2958,9 @@
</span><span class="cx">     if ([attributeName isEqualToString:@&quot;AXDRTElementIdAttribute&quot;])
</span><span class="cx">         return m_object-&gt;getAttribute(idAttr);
</span><span class="cx">     
</span><ins>+    if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+        return [NSNumber numberWithBool:m_object-&gt;caretBrowsingEnabled()];
+    
</ins><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3025,6 +3033,9 @@
</span><span class="cx">     if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
</span><span class="cx">         return YES;
</span><span class="cx">     
</span><ins>+    if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+        return YES;
+    
</ins><span class="cx">     return NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3341,8 +3352,17 @@
</span><span class="cx">             m_object-&gt;setSelectedRows(selectedRows);
</span><span class="cx">     } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
</span><span class="cx">         m_object-&gt;setARIAGrabbed([number boolValue]);
</span><ins>+    else if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
+        m_object-&gt;setCaretBrowsingEnabled([number boolValue]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// Used to set attributes synchronously on accessibility elements within tests.
+// For use with DumpRenderTree only.
+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName
+{
+    [self _accessibilitySetValue:value forAttribute:attributeName];
+}
+
</ins><span class="cx"> static RenderObject* rendererForView(NSView* view)
</span><span class="cx"> {
</span><span class="cx">     if (![view conformsToProtocol:@protocol(WebCoreFrameView)])
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/ChangeLog        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2015-02-26  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Expose caret browsing preference to accessibility API
+        https://bugs.webkit.org/show_bug.cgi?id=141862
+
+        Reviewed by Chris Fleizach.
+
+        Exposing the caret browsing setting on WebCore::Frame via the accessibility API would allow assistive tech apps to enable it contextually (for example, when the assistive tech app is running).
+        Enabling caret browsing when assistive tech apps are running greatly improves the reliability of keyboard navigation on the web. Most especially in cases where selection would be disrupted by focus events.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (setBoolAttributeValueCallback):
+        (selectedTextMarkerRangeCallback):
+        (resetSelectedTextMarkerRangeCallback):
+        (AccessibilityUIElement::setBoolAttributeValue):
+        (AccessibilityUIElement::selectedTextMarkerRange):
+        (AccessibilityUIElement::resetSelectedTextMarkerRange):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::setBoolAttributeValue):
+        (AccessibilityUIElement::selectedTextMarkerRange):
+        (AccessibilityUIElement::resetSelectedTextMarkerRange):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+        (WTR::AccessibilityUIElement::selectedTextMarkerRange):
+        (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
+        (WTR::AccessibilityUIElement::setBoolAttributeValue):
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::setBoolAttributeValue):
+        (WTR::AccessibilityUIElement::selectedTextMarkerRange):
+        (WTR::AccessibilityUIElement::resetSelectedTextMarkerRange):
+
</ins><span class="cx"> 2015-02-26  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Remove WebKitExportGenerator project (and related)
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -523,6 +523,20 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static JSValueRef setBoolAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    JSStringRef attribute = nullptr;
+    bool value = false;
+    if (argumentCount == 2) {
+        attribute = JSValueToStringCopy(context, arguments[0], exception);
+        value = JSValueToBoolean(context, arguments[1]);
+    }
+    toAXElement(thisObject)-&gt;setBoolAttributeValue(attribute, value);
+    if (attribute)
+        JSStringRelease(attribute);
+    return JSValueMakeUndefined(context);
+}
+
</ins><span class="cx"> static JSValueRef stringAttributeValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx">     JSStringRef attribute = 0;
</span><span class="lines">@@ -703,6 +717,17 @@
</span><span class="cx">     return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)-&gt;textMarkerRangeForElement(uiElement));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static JSValueRef selectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    return AccessibilityTextMarkerRange::makeJSAccessibilityTextMarkerRange(context, toAXElement(thisObject)-&gt;selectedTextMarkerRange());
+}
+
+static JSValueRef resetSelectedTextMarkerRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    toAXElement(thisObject)-&gt;resetSelectedTextMarkerRange();
+    return JSValueMakeUndefined(context);
+}
+
</ins><span class="cx"> static JSValueRef attributedStringForTextMarkerRangeContainsAttributeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><span class="cx">     AccessibilityTextMarkerRange* markerRange = 0;
</span><span class="lines">@@ -1366,6 +1391,10 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(MAC)
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
+#endif
+
</ins><span class="cx"> #if !SUPPORTS_AX_TEXTMARKERS
</span><span class="cx"> 
</span><span class="cx"> AccessibilityTextMarkerRange AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*)
</span><span class="lines">@@ -1378,6 +1407,15 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
+{
+    return nullptr;
+}
+
+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+}
+
</ins><span class="cx"> int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*)
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span><span class="lines">@@ -1600,6 +1638,7 @@
</span><span class="cx">         { &quot;uiElementAttributeValue&quot;, uiElementAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;numberAttributeValue&quot;, numberAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;boolAttributeValue&quot;, boolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { &quot;setBoolAttributeValue&quot;, setBoolAttributeValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { &quot;isAttributeSupported&quot;, isAttributeSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;isAttributeSettable&quot;, isAttributeSettableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;isPressActionSupported&quot;, isPressActionSupportedCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="lines">@@ -1626,6 +1665,8 @@
</span><span class="cx">         { &quot;removeSelection&quot;, removeSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;lineTextMarkerRangeForTextMarker&quot;, lineTextMarkerRangeForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;textMarkerRangeForElement&quot;, textMarkerRangeForElementCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { &quot;selectedTextMarkerRange&quot;, selectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { &quot;resetSelectedTextMarkerRange&quot;, resetSelectedTextMarkerRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { &quot;attributedStringForTextMarkerRangeContainsAttribute&quot;, attributedStringForTextMarkerRangeContainsAttributeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;indexForTextMarker&quot;, indexForTextMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;isTextMarkerValid&quot;, isTextMarkerValidCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="lines">@@ -1659,7 +1700,6 @@
</span><span class="cx">         { &quot;increaseTextSelection&quot;, increaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;decreaseTextSelection&quot;, decreaseTextSelectionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;assistiveTechnologySimulatedFocus&quot;, assistiveTechnologySimulatedFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><del>-        
</del><span class="cx"> #endif
</span><span class="cx">         { 0, 0, 0 }
</span><span class="cx">     };
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -109,6 +109,7 @@
</span><span class="cx">     void uiElementArrayAttributeValue(JSStringRef attribute, Vector&lt;AccessibilityUIElement&gt;&amp; elements) const;
</span><span class="cx">     AccessibilityUIElement uiElementAttributeValue(JSStringRef attribute) const;    
</span><span class="cx">     bool boolAttributeValue(JSStringRef attribute);
</span><ins>+    void setBoolAttributeValue(JSStringRef attribute, bool value);
</ins><span class="cx">     bool isAttributeSupported(JSStringRef attribute);
</span><span class="cx">     bool isAttributeSettable(JSStringRef attribute);
</span><span class="cx">     bool isPressActionSupported();
</span><span class="lines">@@ -251,6 +252,8 @@
</span><span class="cx">     AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker*);
</span><span class="cx">     AccessibilityTextMarker startTextMarker();
</span><span class="cx">     AccessibilityTextMarker endTextMarker();
</span><ins>+    AccessibilityTextMarkerRange selectedTextMarkerRange();
+    void resetSelectedTextMarkerRange();
</ins><span class="cx">     
</span><span class="cx">     JSStringRef stringForTextMarkerRange(AccessibilityTextMarkerRange*);
</span><span class="cx">     int textMarkerRangeLength(AccessibilityTextMarkerRange*);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -65,12 +65,17 @@
</span><span class="cx"> #define NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute @&quot;AXStartTextMarkerForBounds&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
+#define NSAccessibilitySelectedTextMarkerRangeAttribute @&quot;AXSelectedTextMarkerRange&quot;
+#endif
+
</ins><span class="cx"> typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
</span><span class="cx"> 
</span><span class="cx"> @interface NSObject (WebKitAccessibilityAdditions)
</span><span class="cx"> - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
</span><span class="cx"> - (NSUInteger)accessibilityIndexOfChild:(id)child;
</span><span class="cx"> - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
</span><ins>+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
</span><span class="lines">@@ -578,6 +583,13 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]];
+    END_AX_OBJC_EXCEPTIONS
+}
+
</ins><span class="cx"> bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
</span><span class="cx"> {
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span><span class="lines">@@ -1560,6 +1572,32 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    return AccessibilityTextMarkerRange(textMarkerRange);
+    END_AX_OBJC_EXCEPTIONS
+    
+    return nullptr;
+}
+
+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+    id start = [m_element accessibilityAttributeValue:@&quot;AXStartTextMarker&quot;];
+    if (!start)
+        return;
+    
+    NSArray* textMarkers = @[start, start];
+    id textMarkerRange = [m_element accessibilityAttributeValue:@&quot;AXTextMarkerRangeForUnorderedTextMarkers&quot; forParameter:textMarkers];
+    if (!textMarkerRange)
+        return;
+    
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    END_AX_OBJC_EXCEPTIONS
+}
+
</ins><span class="cx"> int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range)
</span><span class="cx"> {
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -211,5 +211,11 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY)
+PassRefPtr&lt;AccessibilityTextMarkerRange&gt; AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; }
+void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
+#endif
+
</ins><span class="cx"> } // namespace WTR
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -105,6 +105,7 @@
</span><span class="cx">     JSValueRef uiElementArrayAttributeValue(JSStringRef attribute) const;
</span><span class="cx">     PassRefPtr&lt;AccessibilityUIElement&gt; uiElementAttributeValue(JSStringRef attribute) const;
</span><span class="cx">     bool boolAttributeValue(JSStringRef attribute);
</span><ins>+    void setBoolAttributeValue(JSStringRef attribute, bool value);
</ins><span class="cx">     bool isAttributeSupported(JSStringRef attribute);
</span><span class="cx">     bool isAttributeSettable(JSStringRef attribute);
</span><span class="cx">     bool isPressActionSupported();
</span><span class="lines">@@ -229,6 +230,8 @@
</span><span class="cx">     PassRefPtr&lt;AccessibilityTextMarkerRange&gt; lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
</span><span class="cx">     PassRefPtr&lt;AccessibilityTextMarkerRange&gt; textMarkerRangeForElement(AccessibilityUIElement*);    
</span><span class="cx">     PassRefPtr&lt;AccessibilityTextMarkerRange&gt; textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker);
</span><ins>+    PassRefPtr&lt;AccessibilityTextMarkerRange&gt; selectedTextMarkerRange();
+    void resetSelectedTextMarkerRange();
</ins><span class="cx">     PassRefPtr&lt;AccessibilityTextMarker&gt; startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
</span><span class="cx">     PassRefPtr&lt;AccessibilityTextMarker&gt; endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
</span><span class="cx">     PassRefPtr&lt;AccessibilityTextMarker&gt; endTextMarkerForBounds(int x, int y, int width, int height);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx">     object uiElementArrayAttributeValue(DOMString attr);
</span><span class="cx">     AccessibilityUIElement uiElementAttributeValue(DOMString attr);  
</span><span class="cx">     boolean boolAttributeValue(DOMString attr);
</span><ins>+    void setBoolAttributeValue(DOMString attr, boolean value);
</ins><span class="cx">     boolean isAttributeSupported(DOMString attr);
</span><span class="cx">     boolean isAttributeSettable(DOMString attr);
</span><span class="cx">     boolean isPressActionSupported();
</span><span class="lines">@@ -174,6 +175,8 @@
</span><span class="cx">     AccessibilityTextMarkerRange lineTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
</span><span class="cx">     AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element);    
</span><span class="cx">     AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);
</span><ins>+    AccessibilityTextMarkerRange selectedTextMarkerRange();
+    void resetSelectedTextMarkerRange();
</ins><span class="cx">     AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
</span><span class="cx">     AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
</span><span class="cx">     AccessibilityTextMarker endTextMarkerForBounds(int x, int y, int width, int height);
</span><span class="lines">@@ -201,6 +204,5 @@
</span><span class="cx">     // Notification support.
</span><span class="cx">     boolean addNotificationListener(object callbackFunction);
</span><span class="cx">     boolean removeNotificationListener();
</span><del>-    
</del><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (180717 => 180718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2015-02-27 01:56:38 UTC (rev 180717)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2015-02-27 01:57:48 UTC (rev 180718)
</span><span class="lines">@@ -69,12 +69,17 @@
</span><span class="cx"> #define NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute @&quot;AXStartTextMarkerForBounds&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilitySelectedTextMarkerRangeAttribute
+#define NSAccessibilitySelectedTextMarkerRangeAttribute @&quot;AXSelectedTextMarkerRange&quot;
+#endif
+
</ins><span class="cx"> typedef void (*AXPostedNotificationCallback)(id element, NSString* notification, void* context);
</span><span class="cx"> 
</span><span class="cx"> @interface NSObject (WebKitAccessibilityAdditions)
</span><span class="cx"> - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
</span><span class="cx"> - (NSUInteger)accessibilityIndexOfChild:(id)child;
</span><span class="cx"> - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute;
</span><ins>+- (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName;
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="lines">@@ -623,6 +628,13 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AccessibilityUIElement::setBoolAttributeValue(JSStringRef attribute, bool value)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element _accessibilitySetTestValue:@(value) forAttribute:[NSString stringWithJSStringRef:attribute]];
+    END_AX_OBJC_EXCEPTIONS
+}
+
</ins><span class="cx"> bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
</span><span class="cx"> {
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span><span class="lines">@@ -1623,7 +1635,33 @@
</span><span class="cx">     
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><ins>+    
+PassRefPtr&lt;AccessibilityTextMarkerRange&gt; AccessibilityUIElement::selectedTextMarkerRange()
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    END_AX_OBJC_EXCEPTIONS
+    
+    return nullptr;
+}
</ins><span class="cx"> 
</span><ins>+void AccessibilityUIElement::resetSelectedTextMarkerRange()
+{
+    id start = [m_element accessibilityAttributeValue:@&quot;AXStartTextMarker&quot;];
+    if (!start)
+        return;
+    
+    NSArray* textMarkers = @[start, start];
+    id textMarkerRange = [m_element accessibilityAttributeValue:@&quot;AXTextMarkerRangeForUnorderedTextMarkers&quot; forParameter:textMarkers];
+    if (!textMarkerRange)
+        return;
+    
+    BEGIN_AX_OBJC_EXCEPTIONS
+    [m_element _accessibilitySetTestValue:textMarkerRange forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    END_AX_OBJC_EXCEPTIONS
+}
+
</ins><span class="cx"> PassRefPtr&lt;AccessibilityTextMarker&gt; AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range)
</span><span class="cx"> {
</span><span class="cx">     BEGIN_AX_OBJC_EXCEPTIONS
</span></span></pre>
</div>
</div>

</body>
</html>