OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <body> | 3 <body> |
4 <div id="console"></div> | 4 <div id="console"></div> |
5 <div style="position: relative; width: 1600px; height: 2400px; background-
color: green;"> | 5 <div style="position: relative; width: 1600px; height: 2400px; background-
color: green;"> |
6 <div style="position:absolute; left: 600px; top: 800px;"> <input id="tex
tbox" type="text"></div> | 6 <div style="position:absolute; left: 600px; top: 800px;"> <input id="tex
tbox" type="text"></div> |
7 </div> | 7 </div> |
8 </body> | 8 </body> |
9 <script src="../js/resources/js-test-pre.js"></script> | 9 <script src="../js/resources/js-test-pre.js"></script> |
10 <script> | 10 <script> |
11 var box = document.getElementById('textbox'); | 11 var box = document.getElementById('textbox'); |
12 if (window.internals) { | 12 if (window.internals) { |
13 window.internals.scrollElementToRect(box, 0, 100, 300, 300); | 13 window.internals.scrollElementToRect(box, 0, 100, 300, 300); |
14 window.internals.scrollElementToRect(box, 0, 0, 300, 300); | 14 window.internals.scrollElementToRect(box, 0, 0, 300, 300); |
15 } | 15 } |
16 | 16 |
17 var rect = box.getBoundingClientRect(); | 17 var rect = box.getBoundingClientRect(); |
18 var computedLeft = Math.floor((300 - rect.width) / 2); | 18 var computedLeft = Math.floor((300 - rect.width) / 2); |
19 var computedTop = Math.floor((300 - rect.height) / 2); | 19 var computedTop = Math.floor((300 - rect.height) / 2); |
20 debug("Scrolled element to rect"); | 20 debug("Scrolled element to rect"); |
21 shouldBe("rect.left", "computedLeft"); | 21 shouldBe("rect.left", "computedLeft"); |
22 shouldBe("rect.top", "computedTop"); | 22 shouldBe("rect.top", "computedTop"); |
23 if (window.testRunner) { | 23 if (window.testRunner) { |
24 testRunner.dumpAsText(); | 24 testRunner.dumpAsText(); |
25 } | 25 } |
26 </script> | 26 </script> |
27 <script src="../js/resources/js-test-post.js"></script> | |
28 </head> | 27 </head> |
29 </html> | 28 </html> |
OLD | NEW |