Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-viewport/zoom/iframe-zoom-nested.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>nested iframes with CSS zoom</title>
<link rel="author" title="Yotam Hacohen" href="mailto:yotha@chromium.org">
<link rel="author" title="Stefan Zager" href="mailto:szager@chromium.org">
<link href="reference/iframe-zoom-nested-ref.html" rel="match">
<script src="/common/reftest-wait.js"></script>
<style>
body {
columns: 2;
--iframe-width: 256px;
--iframe-height: 128px;
}
iframe {
border: none;
width: var(--iframe-width);
height: var(--iframe-height);
}
.zoom {
zoom: 1.5;
}
</style>
</head>
<body>
<script>
let loadedCount = 0;
// Register message listener immediately (not inside load handler) to avoid
// missing leaf_loaded messages that arrive before the window load event.
addEventListener("message", ({ data }) => {
// We need to wait for the nested iframe (leaf.html) to load, in addition
// to the top-level iframe (nested-iframe.html).
if (data != "leaf_loaded") return;
loadedCount += 1;
if (loadedCount == document.querySelectorAll('iframe').length) {
takeScreenshot();
}
});
</script>
<iframe id="baseline" src="resources/nested-iframe.html" scrolling="no"></iframe>
<iframe id="zoom-child" src="resources/nested-iframe.html?zoom=2" scrolling="no"></iframe>
<iframe id="zoom-top" class="zoom" src="resources/nested-iframe.html" scrolling="no"></iframe>
<iframe id="zoom-top-child" class="zoom" src="resources/nested-iframe.html?zoom=2" scrolling="no"></iframe>