blob: e7ba1347a3dcd35c990242ceca1d253d7b97afd8 [file] [log] [blame]
<html>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/ui-helper.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)
window.internals.setPageScaleFactor(2, 0, 0);
shouldBeNonZero("frame.contentWindow.innerWidth");
shouldBeNonZero("frame.contentWindow.innerHeight");
shouldBe("frame.contentWindow.innerWidth", "originalWidth");
scrollbarWidth = UIHelper.isIOSFamily() ? 0 : 15;
shouldBe("frame.contentWindow.innerHeight", "originalHeight - scrollbarWidth");
finishJSTest();
}
window.onload = function() {
// We must use setTimeout since the innerWidth/innerHeight are not yet valid for the iframe.
window.setTimeout(runTest, 0);
}
</script>
<iframe id="iframe" style="width: 100%; height: 100%;"></iframe>
<script src="../../resources/js-test-post.js"></script>
</html>