Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: LayoutTests/editing/text-iterator/findString.html

Issue 624483002: Make TextIterator not stop at IMG element for finding text separating inline image (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/editing/text-iterator/findString-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <meta charset="utf-8"> 1 <meta charset="utf-8">
2 <div id="container"></div> 2 <div id="container"></div>
3 <pre id="console" style="visibility: hidden;"></pre> 3 <pre id="console" style="visibility: hidden;"></pre>
4 <script> 4 <script>
5 function log(message) 5 function log(message)
6 { 6 {
7 document.getElementById("console").appendChild(document.createTextNode(m essage + "\n")); 7 document.getElementById("console").appendChild(document.createTextNode(m essage + "\n"));
8 } 8 }
9 9
10 function testFindString(text, target, options, expectedRanges) 10 function testFindString(text, target, options, expectedRanges)
11 { 11 {
12 log("Searching for \u2018" + target + "\u2019 " + (text.length <= 64 ? " in \u2018" + text + "\u2019 " : "in long string ") + "with options [" + options. join(", ") + "]:"); 12 log("Searching for \u2018" + target + "\u2019 " + (text.length <= 64 ? " in \u2018" + text + "\u2019 " : "in long string ") + "with options [" + options. join(", ") + "]:");
13 13
14 var container = document.getElementById("container"); 14 var container = document.getElementById("container");
15 container.innerText = text; 15 container.innerHTML = text;
16 document.body.offsetTop; 16 document.body.offsetTop;
17 var selection = getSelection(); 17 var selection = getSelection();
18 selection.empty(); 18 selection.empty();
19 19
20 var expectedRange; 20 var expectedRange;
21 while (expectedRange = expectedRanges.shift()) { 21 while (expectedRange = expectedRanges.shift()) {
22 var found = testRunner.findString(target, options); 22 var found = testRunner.findString(target, options);
23 if (found) { 23 if (found) {
24 var actualRange = [selection.baseOffset, selection.extentOffset] ; 24 var actualRange = [selection.baseOffset, selection.extentOffset] ;
25 if (expectedRange[0] !== actualRange[0] || expectedRange[1] !== actualRange[1]) 25 if (expectedRange[0] !== actualRange[0] || expectedRange[1] !== actualRange[1])
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize) + thaiWords.join("") + bufferSizedString, thaiWords[0], [], [[searchBufferUnover lappedSize, searchBufferUnoverlappedSize + 2], [searchBufferUnoverlappedSize + 1 0, searchBufferUnoverlappedSize + 12], [searchBufferUnoverlappedSize + 12, searc hBufferUnoverlappedSize + 14], []]); 103 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize) + thaiWords.join("") + bufferSizedString, thaiWords[0], [], [[searchBufferUnover lappedSize, searchBufferUnoverlappedSize + 2], [searchBufferUnoverlappedSize + 1 0, searchBufferUnoverlappedSize + 12], [searchBufferUnoverlappedSize + 12, searc hBufferUnoverlappedSize + 14], []]);
104 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize) + thaiWords.join("") + bufferSizedString, thaiWords[0], ["AtWordStarts"], [[sear chBufferUnoverlappedSize + 12, searchBufferUnoverlappedSize + 14], []]); 104 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize) + thaiWords.join("") + bufferSizedString, thaiWords[0], ["AtWordStarts"], [[sear chBufferUnoverlappedSize + 12, searchBufferUnoverlappedSize + 14], []]);
105 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 1) + " " + thaiWords.join("") + bufferSizedString, thaiWords[0], ["AtWordStarts "], [[searchBufferUnoverlappedSize, searchBufferUnoverlappedSize + 2], [searchBu fferUnoverlappedSize + 12, searchBufferUnoverlappedSize + 14], []]); 105 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 1) + " " + thaiWords.join("") + bufferSizedString, thaiWords[0], ["AtWordStarts "], [[searchBufferUnoverlappedSize, searchBufferUnoverlappedSize + 2], [searchBu fferUnoverlappedSize + 12, searchBufferUnoverlappedSize + 14], []]);
106 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 3) + " " + thaiWords[4] + bufferSizedString, thaiWords[2], ["AtWordStarts"], [[ ]]); 106 testFindString(bufferSizedString.substring(0, searchBufferUnoverlappedSize - 3) + " " + thaiWords[4] + bufferSizedString, thaiWords[2], ["AtWordStarts"], [[ ]]);
107 107
108 testFindString("Spaces, the final frontier", " ", ["AtWordStarts"], [[7, 8], [11, 12], [17, 18], []]); 108 testFindString("Spaces, the final frontier", " ", ["AtWordStarts"], [[7, 8], [11, 12], [17, 18], []]);
109 testFindString("Use an @import rule", "@", ["AtWordStarts"], [[7, 8], []]); 109 testFindString("Use an @import rule", "@", ["AtWordStarts"], [[7, 8], []]);
110 testFindString("If ((x + 5) * 2) = 14, then x = 2", "(x", ["AtWordStarts"], [[4, 6], []]); 110 testFindString("If ((x + 5) * 2) = 14, then x = 2", "(x", ["AtWordStarts"], [[4, 6], []]);
111 111
112 testFindString("hello<img src='../resources/abe.png'>world", "lowo", [], [[3 , 2], []]);
113
112 document.getElementById("console").style.removeProperty("visibility"); 114 document.getElementById("console").style.removeProperty("visibility");
113 </script> 115 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/text-iterator/findString-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698