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