blob: a9e473b56d4eabcb1b988e96ee86c0d76f537cf8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
description("This tests that innerWidth/innerHeight on an frame window returns the size of the frame itself in CSS pixels, regardless of page scale.");
window.jsTestIsAsync = true;
function runTest() {
frame = document.getElementById('iframe');
originalWidth = frame.contentWindow.innerWidth;
originalHeight = frame.contentWindow.innerHeight;
if (window.internals)
internals.setPageScaleFactor(2);
shouldBeNonZero("frame.contentWindow.innerWidth");
shouldBeNonZero("frame.contentWindow.innerHeight");
shouldBe("frame.contentWindow.innerWidth", "originalWidth");
shouldBe("frame.contentWindow.innerHeight", "originalHeight");
finishJSTest();
}
window.onload = function() {
// We must use setTimeout since the innerWidth/innerHeight are not yet valid for the iframe.
window.setTimeout(runTest, 0);
}
</script>
</head>
<body style="width: 1000px; height: 1000px">
<iframe id="iframe" style="width: 100%; height: 100%;"></iframe>
</body>
</html>