| <html> |
| <head> |
| <body> |
| <div id="console"></div> |
| <div style="position: relative; width: 1600px; height: 2400px; background-color: green;"> |
| <div style="position:absolute; left: 600px; top: 800px;"> <input id="textbox" type="text"></div> |
| </div> |
| </body> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| var box = document.getElementById('textbox'); |
| if (window.internals) { |
| window.internals.scrollElementToRect(box, 0, 100, 300, 300); |
| window.internals.scrollElementToRect(box, 0, 0, 300, 300); |
| } |
| |
| var rect = box.getBoundingClientRect(); |
| var computedLeft = Math.floor((300 - rect.width) / 2); |
| var computedTop = Math.floor((300 - rect.height) / 2); |
| debug("Scrolled element to rect"); |
| shouldBe("rect.left", "computedLeft"); |
| shouldBe("rect.top", "computedTop"); |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| } |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </head> |
| </html> |