blob: c6777a13e1be102252d286b6c826e4cfbf28d875 [file] [log] [blame]
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<style>
#pusher {
width: 1000px;
height: 1000px;
outline: 1px solid black;
}
</style>
<div id="console"></div>
<div id="testArea">
<br>
<p id="test">Test content</p>
<div id="pusher">This box is here to create scrollbars.</div>
</div>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var element = document.getElementById('test');
// Get base numbers
var unScrolledBoundingBox = element.getBoundingClientRect();
var unScrolledBoundingBoxes = element.getClientRects();
// Test scrolling down
window.scrollBy(0, 50);
var scrolledDownBoundingBox = element.getBoundingClientRect();
var scrolledDownBoundingBoxes = element.getClientRects();
// Reset
window.scrollTo(0, 0);
// Test scrolling right
window.scrollBy(50, 0);
var scrolledRightBoundingBox = element.getBoundingClientRect();
var scrolledRightBoundingBoxes = element.getClientRects();
// Reset
window.scrollTo(0, 0);
shouldBe("unScrolledBoundingBox.top - scrolledDownBoundingBox.top", "50");
shouldBe("unScrolledBoundingBoxes[0].top - scrolledDownBoundingBoxes[0].top", "50");
shouldBe("unScrolledBoundingBox.left - scrolledRightBoundingBox.left", "50");
shouldBe("unScrolledBoundingBoxes[0].left - scrolledRightBoundingBoxes[0].left", "50");
if (window.layoutTestController) {
var area = document.getElementById('testArea');
area.parentNode.removeChild(area);
}
successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>