2 <script src=
"../../../resources/js-test.js"></script>
7 outline:
1px solid black;
10 <div id=
"console"></div>
13 <p id=
"test">Test content
</p>
14 <div id=
"pusher">This box is here to create scrollbars.
</div>
17 if (window
.testRunner
)
18 testRunner
.dumpAsText();
20 var range
= document
.createRange();
21 range
.selectNodeContents(document
.getElementById('test'));
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();
33 window
.scrollTo(0, 0);
35 // Test scrolling right
36 window
.scrollBy(50, 0);
37 var scrolledRightBoundingBox
= range
.getBoundingClientRect();
38 var scrolledRightBoundingBoxes
= range
.getClientRects();
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
);