blob: fc73e824d4fef6a4e7d8d75c6b31f85acb6c3256 [file] [edit]
<html>
<head>
<style>
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
</style>
<script src="../../resources/js-test-pre.js"></script>
<script>
window.enablePixelTesting = true;
if (window.testRunner)
testRunner.waitUntilDone();
// Layout for the iframe will be scaled down to a quarter.
// It appears this bug will only manifest itself if layout for the
// iframe has not yet been computed. If we've already laid out
// the iframe, then CSSStyleSelector::styleForDocument does not appear
// to get called for the iframe.
scalePage(0.5).then(() => {
let frame = document.createElement("iframe");
frame.src = "resources/iframe-content-scaling-bug-iframe.html";
frame.style = "position: absolute; left: 0px; top: 0px; border: none; width: 300px; height: 300px;";
document.getElementById("body").appendChild(frame);
});
async function scalePage(scaleFactor) {
var scaleOffset = 0;
if (window.testRunner) {
await window.testRunner.setPageScaleFactor(scaleFactor, scaleOffset, scaleOffset);
}
}
async function test() {
// Curiously, the document style for the iframe does not
// appear to be recalculated after this
await scalePage(1.0);
document.body.offsetWidth;
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body" onload="test();">
<div id="rightbox" style="position: absolute; left: 300px; top: 0px; width: 300px; height: 300px; background-color: green;"></div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>