blob: d57886663ed12974fd0723c941943cc39b2e8bc7 [file] [edit]
<html>
<body onload="runTest();">
<script src="../../resources/js-test.js"></script>
<script>
description("This test ensures that document content width (height) as reported by scrollWidth (scrollHeight) is invariant to changes in page scale factor.");
window.jsTestIsAsync = true;
var body = document.body;
// According to CSSOM (http://dev.w3.org/csswg/cssom-view/#dom-element-scrollwidth)
// the scrollWidth of the body element (in Quirks mode) is defined as
// max(document content width, value of innerWidth).
// In this test, we want to measure the document content width (height),
// rather than innerWidth (innerHeight), so we make the body element
// larger than the innerWidth (innerHeight).
body.style["width"] = window.innerWidth + 100 + "px";
body.style["height"] = window.innerHeight + 100 + "px";
var originalScrollWidth = body.scrollWidth;
var originalScrollHeight = body.scrollHeight;
var scale = 1.1;
function runTest (){
if (window.testRunner)
testRunner.setPageScaleFactor(scale, 0, 0).then(() => {
// As we have increased the scale factor, the innerWidth will be less
// as fewer CSS pixels will be rendered in the same viewport, so
// body.scrollWidth (scrollHeight) will still be measuring the document
// content width (height).
shouldBe("body.scrollWidth", "originalScrollWidth");
shouldBe("body.scrollHeight", "originalScrollHeight");
finishJSTest();
});
}
</script>
</body>
</html>