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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/extend-to-line-boundary.html

Issue 1922223003: Change linesBoundingBox to return LayoutRect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body> 2 <body>
3 <pre id="console"></pre> 3 <pre id="console"></pre>
4 <script> 4 <script>
5 function log(s) { 5 function log(s) {
6 document.getElementById("console").innerHTML += s + "\n"; 6 document.getElementById("console").innerHTML += s + "\n";
7 } 7 }
8 8
9 function createEditableMultilineDiv(text, numLines) { 9 function createEditableMultilineDiv(text, numLines) {
10 // Put text in a span so that the width can be measured. 10 // Put text in a span so that the width can be measured.
11 var span = document.createElement("span"); 11 var span = document.createElement("span");
12 span.innerHTML = text; 12 span.innerHTML = text;
13 document.body.appendChild(span); 13 document.body.appendChild(span);
14 var widthPx = span.offsetWidth; 14 var widthPx = Math.ceil(span.getBoundingClientRect().width);
15 document.body.removeChild(span); 15 document.body.removeChild(span);
16 16
17 // Make div with those dimensions so that the text wraps predictably regardl ess of platform. 17 // Make div with those dimensions so that the text wraps predictably regardl ess of platform.
18 var lines = text; 18 var lines = text;
19 for (var i = 1; i < numLines; i++) 19 for (var i = 1; i < numLines; i++)
20 lines += " " + text; 20 lines += " " + text;
21 21
22 var div = document.createElement("div"); 22 var div = document.createElement("div");
23 div.setAttribute("style", "width: " + widthPx + "px"); 23 div.setAttribute("style", "width: " + widthPx + "px");
24 div.contentEditable = true; 24 div.contentEditable = true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 log("PASS for RTL"); 61 log("PASS for RTL");
62 else 62 else
63 log("FAIL for RTL, selection is '" + getSelection() + "' but should be '" + rtlText + " '"); 63 log("FAIL for RTL, selection is '" + getSelection() + "' but should be '" + rtlText + " '");
64 64
65 log(""); 65 log("");
66 66
67 if (window.testRunner) 67 if (window.testRunner)
68 testRunner.dumpAsText(); 68 testRunner.dumpAsText();
69 </script> 69 </script>
70 </body> 70 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698