Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Range / getBoundingClientRect-getClientRects-relative-to-viewport.html
blobc22a358ee622c1f0eb8c9b4a27af9f29f7fa2a4c
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 #pusher {
5 width: 1000px;
6 height: 1000px;
7 outline: 1px solid black;
9 </style>
10 <div id="console"></div>
11 <div id="testArea">
12 <br>
13 <p id="test">Test content</p>
14 <div id="pusher">This box is here to create scrollbars.</div>
15 </div>
16 <script>
17 if (window.testRunner)
18 testRunner.dumpAsText();
20 var range = document.createRange();
21 range.selectNodeContents(document.getElementById('test'));
23 // Get base numbers
24 var unScrolledBoundingBox = range.getBoundingClientRect();
25 var unScrolledBoundingBoxes = range.getClientRects();
27 // Test scrolling down
28 window.scrollBy(0, 50);
29 var scrolledDownBoundingBox = range.getBoundingClientRect();
30 var scrolledDownBoundingBoxes = range.getClientRects();
32 // Reset
33 window.scrollTo(0, 0);
35 // Test scrolling right
36 window.scrollBy(50, 0);
37 var scrolledRightBoundingBox = range.getBoundingClientRect();
38 var scrolledRightBoundingBoxes = range.getClientRects();
40 // Reset
41 window.scrollTo(0, 0);
43 shouldBe("unScrolledBoundingBox.top - scrolledDownBoundingBox.top", "50");
44 shouldBe("unScrolledBoundingBoxes[0].top - scrolledDownBoundingBoxes[0].top", "50");
45 shouldBe("unScrolledBoundingBox.left - scrolledRightBoundingBox.left", "50");
46 shouldBe("unScrolledBoundingBoxes[0].left - scrolledRightBoundingBoxes[0].left", "50");
48 if (window.testRunner) {
49 var area = document.getElementById('testArea');
50 area.parentNode.removeChild(area);
52 </script>