Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / scroll-element-to-rect.html
blob2acc2189c7e99bbedc08eb0cadbf681551e25777
1 <html>
2 <head>
3 <body>
4 <div id="console"></div>
5 <div style="position: relative; width: 1600px; height: 2400px; background-color: green;">
6 <div style="position:absolute; left: 600px; top: 800px;"> <input id="textbox" type="text"></div>
7 </div>
8 </body>
9 <script src="../../resources/js-test.js"></script>
10 <script>
11 var box = document.getElementById('textbox');
12 if (window.internals) {
13 window.internals.scrollElementToRect(box, 0, 100, 300, 300);
14 window.internals.scrollElementToRect(box, 0, 0, 300, 300);
17 var rect = box.getBoundingClientRect();
18 var computedLeft = Math.floor((300 - rect.width) / 2);
19 var computedTop = Math.floor((300 - rect.height) / 2);
20 debug("Scrolled element to rect");
21 shouldBe("rect.left", "computedLeft");
22 shouldBe("rect.top", "computedTop");
23 if (window.testRunner) {
24 testRunner.dumpAsText();
26 </script>
27 </head>
28 </html>