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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Range/getBoundingClientRect-linebreak-character.html

Issue 2763013002: Fix incorrect bounding box position for '\n' (Closed)
Patch Set: Refactor to populate one vector. Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <style>
7 body {
8 margin: 0;
9 font-family: monospace;
10 font-size: 15px;
11 line-height: 1;
12 }
13
14 div#testArea {
15 white-space: pre;
16 }
17 </style>
18 </head>
19 <body>
20 <div id="testArea">
21 </div>
22
23 <script>
24 test(function() {
25 var div = document.getElementById("testArea");
26 div.textContent = 'a\nb\n\n\nc';
27
28 var rects=[]
29 for (var i = 0; i < div.textContent.length; ++i) {
30 var range = document.createRange();
31 range.setStart(div.firstChild, i);
32 range.setEnd(div.firstChild, i+1);
33 rects.push(range.getBoundingClientRect());
34 }
35
36 assert_greater_than(rects[2].top, rects[1].top,
37 'Top of the rect of offset(2,3) should be greater than offset(1, 2)')
38 assert_greater_than(rects[4].top, rects[3].top,
39 'Top of the rect of offset(4,5) should be greater than offset(3, 4)')
40 assert_greater_than(rects[5].top, rects[4].top,
41 'Top of the rect of offset(5,6) should be greater than offset(4, 5)')
42 assert_greater_than(rects[6].top, rects[5].top,
43 'Top of the rect of offset(6,7) should be greater than offset(5, 6)')
44 }, 'BoundingClinentRect of linebreak character should be calculated correc tly');
45 </script>
46 </body>
47 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698