OLD | NEW |
(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> |
OLD | NEW |