<!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>[183448] trunk/LayoutTests</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/183448">183448</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-27 20:05:26 -0700 (Mon, 27 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Break up select text into multiple tests
https://bugs.webkit.org/show_bug.cgi?id=144301

Patch by Doug Russell &lt;d_russell@apple.com&gt; on 2015-04-27
Reviewed by Alexey Proskuryakov.

* platform/mac/TestExpectations:
* platform/mac/accessibility/select-text-expected.txt: Removed.
* platform/mac/accessibility/select-text.html: Removed.
* platform/mac/accessibility/select-text/select-text-1-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-1.html: Added.
* platform/mac/accessibility/select-text/select-text-135546-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-135546.html: Added.
* platform/mac/accessibility/select-text/select-text-135575-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-135575.html: Added.
* platform/mac/accessibility/select-text/select-text-2-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-2.html: Added.
* platform/mac/accessibility/select-text/select-text-3-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-3.html: Added.
* platform/mac/accessibility/select-text/select-text-4-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-4.html: Added.
* platform/mac/accessibility/select-text/select-text-5-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-5.html: Added.
* platform/mac/accessibility/select-text/select-text-6-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-6.html: Added.
* platform/mac/accessibility/select-text/select-text-7-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-7.html: Added.
* platform/mac/accessibility/select-text/select-text-8-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-8.html: Added.
* platform/mac/accessibility/select-text/select-text-9-expected.txt: Added.
* platform/mac/accessibility/select-text/select-text-9.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/platform/mac/accessibility/select-text/</li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext1expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext1html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135546expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135546html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135575expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135575html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext2expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext2html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext3expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext3html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext4expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext4html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext5expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext5html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext6expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext6html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext7expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext7html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext8expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext8html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext9expectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextselecttext9html">trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttextexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselecttexthtml">trunk/LayoutTests/platform/mac/accessibility/select-text.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183447 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-28 02:43:40 UTC (rev 183447)
+++ trunk/LayoutTests/ChangeLog        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-04-27  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        Break up select text into multiple tests
+        https://bugs.webkit.org/show_bug.cgi?id=144301
+
+        Reviewed by Alexey Proskuryakov.
+
+        * platform/mac/TestExpectations:
+        * platform/mac/accessibility/select-text-expected.txt: Removed.
+        * platform/mac/accessibility/select-text.html: Removed.
+        * platform/mac/accessibility/select-text/select-text-1-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-1.html: Added.
+        * platform/mac/accessibility/select-text/select-text-135546-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-135546.html: Added.
+        * platform/mac/accessibility/select-text/select-text-135575-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-135575.html: Added.
+        * platform/mac/accessibility/select-text/select-text-2-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-2.html: Added.
+        * platform/mac/accessibility/select-text/select-text-3-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-3.html: Added.
+        * platform/mac/accessibility/select-text/select-text-4-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-4.html: Added.
+        * platform/mac/accessibility/select-text/select-text-5-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-5.html: Added.
+        * platform/mac/accessibility/select-text/select-text-6-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-6.html: Added.
+        * platform/mac/accessibility/select-text/select-text-7-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-7.html: Added.
+        * platform/mac/accessibility/select-text/select-text-8-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-8.html: Added.
+        * platform/mac/accessibility/select-text/select-text-9-expected.txt: Added.
+        * platform/mac/accessibility/select-text/select-text-9.html: Added.
+
</ins><span class="cx"> 2015-04-27  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Form control may be associated with the wrong HTML Form element after form id change
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (183447 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2015-04-28 02:43:40 UTC (rev 183447)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -1263,6 +1263,3 @@
</span><span class="cx"> # OS X 10.10.3+ has the necessary glyphs.
</span><span class="cx"> webkit.org/b/142548 [ Yosemite+ ] editing/selection/extend-by-character-007.html [ Pass ]
</span><span class="cx"> webkit.org/b/141661 [ Yosemite+ ] fast/text/emoji.html [ Pass ]
</span><del>-
-# Timing out on Yosemite &amp; Mavericks WK1 release sometimes
-webkit.org/b/142719 platform/mac/accessibility/select-text.html [ Pass Timeout ]
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'lazy'
+PASS selection is 'lazy'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-1.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text after selection (single search string).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestAfterSelection&quot;, &quot;lazy&quot;);
+        shouldBe(&quot;result&quot;, &quot;'lazy'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'lazy'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135546expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'quick'
+PASS windowSelection.getRangeAt(0).startOffset is 11
+PASS windowSelection.getRangeAt(0).endOffset is 16
+PASS result is 'quick'
+PASS windowSelection.getRangeAt(0).startOffset is 56
+PASS windowSelection.getRangeAt(0).endOffset is 61
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135546html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135546.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+
+        // [https://bugs.webkit.org/show_bug.cgi?id=135546] 
+        // A matching range before the selection should be selected when searching for closest match.
+        document.getElementById(&quot;text2&quot;).focus();
+        var windowSelection = window.getSelection();
+        windowSelection.removeAllRanges();
+
+        // First find the range before the current selection.
+        var range = document.createRange();
+        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 20);
+        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 20);
+        windowSelection.addRange(range);
+      
+        var text2 = accessibilityController.accessibleElementById(&quot;text2&quot;);
+        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;);
+        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
+        selection = window.getSelection();
+        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;11&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;16&quot;);
+
+        // Move the cursor closer to the second instance in front of the selection.
+        range = document.createRange();
+        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 48);
+        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 48);
+        windowSelection.removeAllRanges();
+        windowSelection.addRange(range);
+
+        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;);
+        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;56&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;61&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135575expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: THE quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS windowSelection.getRangeAt(0).toString() is 'The'
+PASS result is 'THE'
+PASS windowSelection.getRangeAt(0).toString() is 'THE'
+PASS windowSelection.getRangeAt(0).startOffset is 7
+PASS windowSelection.getRangeAt(0).endOffset is 10
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext135575html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-135575.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+
+        document.getElementById(&quot;text2&quot;).focus();
+        var windowSelection = window.getSelection();
+        windowSelection.removeAllRanges();
+
+        // [https://bugs.webkit.org/show_bug.cgi?id=135575]
+        // When an existing range is already selected, we should not ignore that when searching for future activities.
+        // First find the range before the current selection.
+        var range = document.createRange();
+        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 7);
+        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 10);
+        windowSelection.removeAllRanges();
+        windowSelection.addRange(range);
+        shouldBe(&quot;windowSelection.getRangeAt(0).toString()&quot;, &quot;'The'&quot;);
+      
+        var text2 = accessibilityController.accessibleElementById(&quot;text2&quot;);
+        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;the&quot;, null, &quot;AXSelectTextActivityFindAndUppercase&quot;);
+        shouldBe(&quot;result&quot;, &quot;'THE'&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).toString()&quot;, &quot;'THE'&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;7&quot;);
+        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;10&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'over'
+PASS selection is 'over'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-2.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text after selection (multiple search strings).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestAfterSelection&quot;, [&quot;lazy&quot;, &quot;over&quot;]);
+        shouldBe(&quot;result&quot;, &quot;'over'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'over'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext3expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'quick'
+PASS selection is 'quick'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext3html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-3.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text before selection (single search string).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestBeforeSelection&quot;, &quot;quick&quot;);
+        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'quick'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext4expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'fox'
+PASS selection is 'fox'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext4html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-4.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text before selection (multiple search strings).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestBeforeSelection&quot;, [&quot;quick&quot;, &quot;fox&quot;]);
+        shouldBe(&quot;result&quot;, &quot;'fox'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'fox'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext5expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'dog'
+PASS selection is 'dog'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext5html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-5.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text closest to selection (single search string).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;dog&quot;);
+        shouldBe(&quot;result&quot;, &quot;'dog'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'dog'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext6expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'fox'
+PASS selection is 'fox'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext6html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-6.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select text closest to selection (multiple search strings).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, [&quot;dog&quot;, &quot;fox&quot;]);
+        shouldBe(&quot;result&quot;, &quot;'fox'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'fox'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext7expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The slow brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'slow'
+PASS selection is 'slow'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext7html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-7.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select and replace text closest to selection (single search string).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;, &quot;slow&quot;);
+        shouldBe(&quot;result&quot;, &quot;'slow'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'slow'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext8expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick brown cat jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'cat'
+PASS selection is 'cat'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext8html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-8.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+    
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+    
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+        
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+    
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+        
+        // Select and replace text closest to selection (multiple search strings).
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, [&quot;dog&quot;, &quot;fox&quot;], &quot;cat&quot;);
+        shouldBe(&quot;result&quot;, &quot;'cat'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'cat'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext9expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9-expected.txt (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+The quick Brown fox jumps over the lazy dog.
+
+TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+This tests the ability to select and replace text with respect to selection.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS result is 'Brown'
+PASS selection is 'Brown'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextselecttext9html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9.html (0 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text/select-text-9.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;title&gt;Select Text&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
+
+&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
+
+    function selectedText() {
+        return window.getSelection().toString();
+    }
+
+    function selectElementText(element) {
+        var range = document.createRange();
+        range.selectNodeContents(element);
+
+        var selection = window.getSelection();
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+
+    if (window.accessibilityController) {
+        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
+        var result = 0;
+        var selection = 0;
+        var target = document.getElementById(&quot;target&quot;);
+
+        // Select brown and capitalize it.
+        selectElementText(target);
+        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;brown&quot;, null, &quot;AXSelectTextActivityFindAndCapitalize&quot;);
+        shouldBe(&quot;result&quot;, &quot;'Brown'&quot;);
+        selection = selectedText();
+        shouldBe(&quot;selection&quot;, &quot;'Brown'&quot;);
+    }
+&lt;/script&gt;
+
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttextexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt (183447 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt        2015-04-28 02:43:40 UTC (rev 183447)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text-expected.txt        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-The slow BROWN cat jumps over the lazy dog.
-
-TEXT2: THE quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
-
-This tests the ability to select and replace text with respect to selection.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS result is 'lazy'
-PASS selection is 'lazy'
-PASS result is 'over'
-PASS selection is 'over'
-PASS result is 'quick'
-PASS selection is 'quick'
-PASS result is 'fox'
-PASS selection is 'fox'
-PASS result is 'dog'
-PASS selection is 'dog'
-PASS result is 'fox'
-PASS selection is 'fox'
-PASS result is 'slow'
-PASS selection is 'slow'
-PASS result is 'cat'
-PASS selection is 'cat'
-PASS result is 'Brown'
-PASS selection is 'Brown'
-PASS result is 'brown'
-PASS selection is 'brown'
-PASS result is 'BROWN'
-PASS selection is 'BROWN'
-PASS result is 'quick'
-PASS windowSelection.getRangeAt(0).startOffset is 11
-PASS windowSelection.getRangeAt(0).endOffset is 16
-PASS result is 'quick'
-PASS windowSelection.getRangeAt(0).startOffset is 56
-PASS windowSelection.getRangeAt(0).endOffset is 61
-PASS windowSelection.getRangeAt(0).toString() is 'The'
-PASS result is 'THE'
-PASS windowSelection.getRangeAt(0).toString() is 'THE'
-PASS windowSelection.getRangeAt(0).startOffset is 7
-PASS windowSelection.getRangeAt(0).endOffset is 10
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselecttexthtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/accessibility/select-text.html (183447 => 183448)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/select-text.html        2015-04-28 02:43:40 UTC (rev 183447)
+++ trunk/LayoutTests/platform/mac/accessibility/select-text.html        2015-04-28 03:05:26 UTC (rev 183448)
</span><span class="lines">@@ -1,167 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;title&gt;Select Text&lt;/title&gt;
-&lt;/head&gt;
-&lt;body&gt;
-
-&lt;p contenteditable=&quot;true&quot; id=&quot;text&quot;&gt;The quick brown fox &lt;span id=&quot;target&quot;&gt;jumps&lt;/span&gt; over the lazy dog. &lt;/p&gt;
-
-&lt;p contenteditable=&quot;true&quot; id=&quot;text2&quot;&gt;TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
-
-&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-
-&lt;script&gt;
-    description(&quot;This tests the ability to select and replace text with respect to selection.&quot;);
-    
-    function selectedText() {
-        return window.getSelection().toString();
-    }
-    
-    function selectElementText(element) {
-        var range = document.createRange();
-        range.selectNodeContents(element);
-        
-        var selection = window.getSelection();
-        selection.removeAllRanges();
-        selection.addRange(range);
-    }
-    
-    if (window.accessibilityController) {
-        var text = accessibilityController.accessibleElementById(&quot;text&quot;);
-        var result = 0;
-        var selection = 0;
-        var target = document.getElementById(&quot;target&quot;);
-        
-        // Select text after selection (single search string).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestAfterSelection&quot;, &quot;lazy&quot;);
-        shouldBe(&quot;result&quot;, &quot;'lazy'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'lazy'&quot;);
-        
-        // Select text after selection (multiple search strings).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestAfterSelection&quot;, [&quot;lazy&quot;, &quot;over&quot;]);
-        shouldBe(&quot;result&quot;, &quot;'over'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'over'&quot;);
-        
-        // Select text before selection (single search string).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestBeforeSelection&quot;, &quot;quick&quot;);
-        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'quick'&quot;);
-        
-        // Select text before selection (multiple search strings).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestBeforeSelection&quot;, [&quot;quick&quot;, &quot;fox&quot;]);
-        shouldBe(&quot;result&quot;, &quot;'fox'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'fox'&quot;);
-        
-        // Select text closest to selection (single search string).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;dog&quot;);
-        shouldBe(&quot;result&quot;, &quot;'dog'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'dog'&quot;);
-        
-        // Select text closest to selection (multiple search strings).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, [&quot;dog&quot;, &quot;fox&quot;]);
-        shouldBe(&quot;result&quot;, &quot;'fox'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'fox'&quot;);
-        
-        // Select and replace text closest to selection (single search string).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;, &quot;slow&quot;);
-        shouldBe(&quot;result&quot;, &quot;'slow'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'slow'&quot;);
-        
-        // Select and replace text closest to selection (multiple search strings).
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, [&quot;dog&quot;, &quot;fox&quot;], &quot;cat&quot;);
-        shouldBe(&quot;result&quot;, &quot;'cat'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'cat'&quot;);
-
-        // Select brown and capitalize it.
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;brown&quot;, null, &quot;AXSelectTextActivityFindAndCapitalize&quot;);
-        shouldBe(&quot;result&quot;, &quot;'Brown'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'Brown'&quot;);
-
-        // Select Brown and lowercase it.
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;Brown&quot;, null, &quot;AXSelectTextActivityFindAndLowercase&quot;);
-        shouldBe(&quot;result&quot;, &quot;'brown'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'brown'&quot;);
-
-        // Select brown and uppercase it.
-        selectElementText(target);
-        result = text.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;brown&quot;, null, &quot;AXSelectTextActivityFindAndUppercase&quot;);
-        shouldBe(&quot;result&quot;, &quot;'BROWN'&quot;);
-        selection = selectedText();
-        shouldBe(&quot;selection&quot;, &quot;'BROWN'&quot;);
-
-        // [https://bugs.webkit.org/show_bug.cgi?id=135546] 
-        // A matching range before the selection should be selected when searching for closest match.
-        document.getElementById(&quot;text2&quot;).focus();
-        var windowSelection = window.getSelection();
-        windowSelection.removeAllRanges();
-
-        // First find the range before the current selection.
-        var range = document.createRange();
-        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 20);
-        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 20);
-        windowSelection.addRange(range);
-      
-        var text2 = accessibilityController.accessibleElementById(&quot;text2&quot;);
-        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;);
-        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
-        selection = window.getSelection();
-        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;11&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;16&quot;);
-
-        // Move the cursor closer to the second instance in front of the selection.
-        range = document.createRange();
-        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 48);
-        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 48);
-        windowSelection.removeAllRanges();
-        windowSelection.addRange(range);
-
-        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;quick&quot;);
-        shouldBe(&quot;result&quot;, &quot;'quick'&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;56&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;61&quot;);
-
-        // [https://bugs.webkit.org/show_bug.cgi?id=135575]
-        // When an existing range is already selected, we should not ignore that when searching for future activities.
-        // First find the range before the current selection.
-        var range = document.createRange();
-        range.setStart(document.getElementById(&quot;text2&quot;).firstChild, 7);
-        range.setEnd(document.getElementById(&quot;text2&quot;).firstChild, 10);
-        windowSelection.removeAllRanges();
-        windowSelection.addRange(range);
-        shouldBe(&quot;windowSelection.getRangeAt(0).toString()&quot;, &quot;'The'&quot;);
-      
-        var text2 = accessibilityController.accessibleElementById(&quot;text2&quot;);
-        result = text2.selectTextWithCriteria(&quot;AXSelectTextAmbiguityResolutionClosestToSelection&quot;, &quot;the&quot;, null, &quot;AXSelectTextActivityFindAndUppercase&quot;);
-        shouldBe(&quot;result&quot;, &quot;'THE'&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).toString()&quot;, &quot;'THE'&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).startOffset&quot;, &quot;7&quot;);
-        shouldBe(&quot;windowSelection.getRangeAt(0).endOffset&quot;, &quot;10&quot;);
-    }
-&lt;/script&gt;
-
-&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre>
</div>
</div>

</body>
</html>