<!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 <d_russell@apple.com> 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 <d_russell@apple.com>
+
+ 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 <dabates@apple.com>
</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 & 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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text after selection (single search string).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestAfterSelection", "lazy");
+ shouldBe("result", "'lazy'");
+ selection = selectedText();
+ shouldBe("selection", "'lazy'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // [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("text2").focus();
+ var windowSelection = window.getSelection();
+ windowSelection.removeAllRanges();
+
+ // First find the range before the current selection.
+ var range = document.createRange();
+ range.setStart(document.getElementById("text2").firstChild, 20);
+ range.setEnd(document.getElementById("text2").firstChild, 20);
+ windowSelection.addRange(range);
+
+ var text2 = accessibilityController.accessibleElementById("text2");
+ result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick");
+ shouldBe("result", "'quick'");
+ selection = window.getSelection();
+ shouldBe("windowSelection.getRangeAt(0).startOffset", "11");
+ shouldBe("windowSelection.getRangeAt(0).endOffset", "16");
+
+ // Move the cursor closer to the second instance in front of the selection.
+ range = document.createRange();
+ range.setStart(document.getElementById("text2").firstChild, 48);
+ range.setEnd(document.getElementById("text2").firstChild, 48);
+ windowSelection.removeAllRanges();
+ windowSelection.addRange(range);
+
+ result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick");
+ shouldBe("result", "'quick'");
+ shouldBe("windowSelection.getRangeAt(0).startOffset", "56");
+ shouldBe("windowSelection.getRangeAt(0).endOffset", "61");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ document.getElementById("text2").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("text2").firstChild, 7);
+ range.setEnd(document.getElementById("text2").firstChild, 10);
+ windowSelection.removeAllRanges();
+ windowSelection.addRange(range);
+ shouldBe("windowSelection.getRangeAt(0).toString()", "'The'");
+
+ var text2 = accessibilityController.accessibleElementById("text2");
+ result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "the", null, "AXSelectTextActivityFindAndUppercase");
+ shouldBe("result", "'THE'");
+ shouldBe("windowSelection.getRangeAt(0).toString()", "'THE'");
+ shouldBe("windowSelection.getRangeAt(0).startOffset", "7");
+ shouldBe("windowSelection.getRangeAt(0).endOffset", "10");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text after selection (multiple search strings).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestAfterSelection", ["lazy", "over"]);
+ shouldBe("result", "'over'");
+ selection = selectedText();
+ shouldBe("selection", "'over'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text before selection (single search string).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestBeforeSelection", "quick");
+ shouldBe("result", "'quick'");
+ selection = selectedText();
+ shouldBe("selection", "'quick'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text before selection (multiple search strings).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestBeforeSelection", ["quick", "fox"]);
+ shouldBe("result", "'fox'");
+ selection = selectedText();
+ shouldBe("selection", "'fox'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text closest to selection (single search string).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "dog");
+ shouldBe("result", "'dog'");
+ selection = selectedText();
+ shouldBe("selection", "'dog'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select text closest to selection (multiple search strings).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", ["dog", "fox"]);
+ shouldBe("result", "'fox'");
+ selection = selectedText();
+ shouldBe("selection", "'fox'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select and replace text closest to selection (single search string).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick", "slow");
+ shouldBe("result", "'slow'");
+ selection = selectedText();
+ shouldBe("selection", "'slow'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select and replace text closest to selection (multiple search strings).
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", ["dog", "fox"], "cat");
+ shouldBe("result", "'cat'");
+ selection = selectedText();
+ shouldBe("selection", "'cat'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+<title>Select Text</title>
+</head>
+<body>
+
+<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
+
+<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests the ability to select and replace text with respect to selection.");
+
+ 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("text");
+ var result = 0;
+ var selection = 0;
+ var target = document.getElementById("target");
+
+ // Select brown and capitalize it.
+ selectElementText(target);
+ result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "brown", null, "AXSelectTextActivityFindAndCapitalize");
+ shouldBe("result", "'Brown'");
+ selection = selectedText();
+ shouldBe("selection", "'Brown'");
+ }
+</script>
+
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
-
-
-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>-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../../resources/js-test-pre.js"></script>
-<title>Select Text</title>
-</head>
-<body>
-
-<p contenteditable="true" id="text">The quick brown fox <span id="target">jumps</span> over the lazy dog. </p>
-
-<p contenteditable="true" id="text2">TEXT2: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
- description("This tests the ability to select and replace text with respect to selection.");
-
- 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("text");
- var result = 0;
- var selection = 0;
- var target = document.getElementById("target");
-
- // Select text after selection (single search string).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestAfterSelection", "lazy");
- shouldBe("result", "'lazy'");
- selection = selectedText();
- shouldBe("selection", "'lazy'");
-
- // Select text after selection (multiple search strings).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestAfterSelection", ["lazy", "over"]);
- shouldBe("result", "'over'");
- selection = selectedText();
- shouldBe("selection", "'over'");
-
- // Select text before selection (single search string).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestBeforeSelection", "quick");
- shouldBe("result", "'quick'");
- selection = selectedText();
- shouldBe("selection", "'quick'");
-
- // Select text before selection (multiple search strings).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestBeforeSelection", ["quick", "fox"]);
- shouldBe("result", "'fox'");
- selection = selectedText();
- shouldBe("selection", "'fox'");
-
- // Select text closest to selection (single search string).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "dog");
- shouldBe("result", "'dog'");
- selection = selectedText();
- shouldBe("selection", "'dog'");
-
- // Select text closest to selection (multiple search strings).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", ["dog", "fox"]);
- shouldBe("result", "'fox'");
- selection = selectedText();
- shouldBe("selection", "'fox'");
-
- // Select and replace text closest to selection (single search string).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick", "slow");
- shouldBe("result", "'slow'");
- selection = selectedText();
- shouldBe("selection", "'slow'");
-
- // Select and replace text closest to selection (multiple search strings).
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", ["dog", "fox"], "cat");
- shouldBe("result", "'cat'");
- selection = selectedText();
- shouldBe("selection", "'cat'");
-
- // Select brown and capitalize it.
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "brown", null, "AXSelectTextActivityFindAndCapitalize");
- shouldBe("result", "'Brown'");
- selection = selectedText();
- shouldBe("selection", "'Brown'");
-
- // Select Brown and lowercase it.
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "Brown", null, "AXSelectTextActivityFindAndLowercase");
- shouldBe("result", "'brown'");
- selection = selectedText();
- shouldBe("selection", "'brown'");
-
- // Select brown and uppercase it.
- selectElementText(target);
- result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "brown", null, "AXSelectTextActivityFindAndUppercase");
- shouldBe("result", "'BROWN'");
- selection = selectedText();
- shouldBe("selection", "'BROWN'");
-
- // [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("text2").focus();
- var windowSelection = window.getSelection();
- windowSelection.removeAllRanges();
-
- // First find the range before the current selection.
- var range = document.createRange();
- range.setStart(document.getElementById("text2").firstChild, 20);
- range.setEnd(document.getElementById("text2").firstChild, 20);
- windowSelection.addRange(range);
-
- var text2 = accessibilityController.accessibleElementById("text2");
- result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick");
- shouldBe("result", "'quick'");
- selection = window.getSelection();
- shouldBe("windowSelection.getRangeAt(0).startOffset", "11");
- shouldBe("windowSelection.getRangeAt(0).endOffset", "16");
-
- // Move the cursor closer to the second instance in front of the selection.
- range = document.createRange();
- range.setStart(document.getElementById("text2").firstChild, 48);
- range.setEnd(document.getElementById("text2").firstChild, 48);
- windowSelection.removeAllRanges();
- windowSelection.addRange(range);
-
- result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "quick");
- shouldBe("result", "'quick'");
- shouldBe("windowSelection.getRangeAt(0).startOffset", "56");
- shouldBe("windowSelection.getRangeAt(0).endOffset", "61");
-
- // [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("text2").firstChild, 7);
- range.setEnd(document.getElementById("text2").firstChild, 10);
- windowSelection.removeAllRanges();
- windowSelection.addRange(range);
- shouldBe("windowSelection.getRangeAt(0).toString()", "'The'");
-
- var text2 = accessibilityController.accessibleElementById("text2");
- result = text2.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "the", null, "AXSelectTextActivityFindAndUppercase");
- shouldBe("result", "'THE'");
- shouldBe("windowSelection.getRangeAt(0).toString()", "'THE'");
- shouldBe("windowSelection.getRangeAt(0).startOffset", "7");
- shouldBe("windowSelection.getRangeAt(0).endOffset", "10");
- }
-</script>
-
-<script src="../../../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre>
</div>
</div>
</body>
</html>