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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/text/text-range-bounds.html

Issue 1908533002: Remove superfluous "*-expected.txt" files in LayoutTests/fast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>Tests text range bounds</title> 5 <title>Tests text range bounds</title>
6 <style> 6 <style>
7 div { text-rendering: optimizeLegibility; } 7 div { text-rendering: optimizeLegibility; visibility: hidden; }
8 </style> 8 </style>
9 <script src="../../resources/testharness.js"></script> 9 <script src="../../resources/testharness.js"></script>
10 <script src="../../resources/testharnessreport.js"></script> 10 <script src="../../resources/testharnessreport.js"></script>
11 </head> 11 </head>
12 <body> 12 <body>
13 <div id="test">Tests caret position reporting using ranges.</div> 13 <div id="test">Tests caret position reporting using ranges.</div>
14 <script> 14 <script>
15 var el = document.getElementById('test'); 15 var el = document.getElementById('test');
16 var len = el.firstChild.textContent.length; 16 var len = el.firstChild.textContent.length;
17 17
18 function posForOffset(offset) { 18 function posForOffset(offset) {
19 var r = document.createRange(); 19 var r = document.createRange();
20 r.setStart(el.firstChild, offset); 20 r.setStart(el.firstChild, offset);
21 r.setEnd(el.firstChild, offset); 21 r.setEnd(el.firstChild, offset);
22 return r.getClientRects()[0].left; 22 return r.getClientRects()[0].left;
23 } 23 }
24 24
25 test(function() { 25 test(function() {
26 assert_true(posForOffset(len) > posForOffset(len - 1), 26 assert_true(posForOffset(len) > posForOffset(len - 1),
27 'Last caret position should be higher than second to last.') ; 27 'Last caret position should be higher than second to last.') ;
28 assert_true(posForOffset(len) != posForOffset(0), 28 assert_true(posForOffset(len) != posForOffset(0),
29 'Last caret position should not match first.'); 29 'Last caret position should not match first.');
30 }, 'Caret positions reported correctly.'); 30 }, 'Caret positions reported correctly.');
31 </script> 31 </script>
32 </body> 32 </body>
33 </html> 33 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698