blob: e47ceacddea57e4504fec4f3575ae8b772413c2b [file] [log] [blame]
<html>
<head>
<style>
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
</style>
<script>
window.enablePixelTesting = true;
function scrollViaJavascript() {
var scaleFactor = 2.0;
if (window.internals) {
window.internals.setPageScaleFactor(scaleFactor, 0, 0);
}
// The page scale, as set by window.internals.setPageScaleFactor should not be apparent
// to javascript. So, we expect scrolling to (100,100) to be page coordinates, rather
// than device pixels.
document.body.scrollLeft = 100;
document.body.scrollTop = 100;
shouldBe("window.document.body.scrollTop", "100");
shouldBe("window.document.body.scrollLeft", "100");
shouldBe("window.scrollX", "100");
shouldBe("window.scrollY", "100");
}
function scrollViaSetScaleFactor() {
if (window.internals) {
// Test that the scroll offset changes even if scaleFactor remains
// the same.
window.internals.setPageScaleFactor(1, 30, 30);
shouldBe("window.document.body.scrollTop", "30");
shouldBe("window.document.body.scrollLeft", "30");
}
}
function test() {
scrollViaSetScaleFactor();
scrollViaJavascript();
}
</script>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body style="width:2000px; height:2000px; margin:0px;" onload="test();">
<div style="left:0; top:0; width:100px; height:100px; position:absolute; background:yellow;"></div>
<div style="left:100px; top:0; width:100px; height:100px; position:absolute; background:green;"></div>
<div style="left:200px; top:0; width:100px; height:100px; position:absolute; background:blue;"></div>
<div style="left:0; top:100px; width:100px; height:100px; position:absolute; background: green;"></div>
<div style="left:100px; top:100px; width:100px; height:100px; position:absolute; background:blue;"></div>
<div style="left:200px; top:100px; width:100px; height:100px; position:absolute; background:yellow;"></div>
<div id="console"></div>
</body>
</html>