Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-view-transitions/snapshot-containing-block-static-iframe.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: use snapshot containing block for static position in iframe</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/#snapshot-containing-block-concept/">
<link rel="match" href="snapshot-containing-block-static-iframe-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<style>
#inner {
width: 400px;
height: 200px;
}
</style>
<iframe id="inner" srcdoc="
<style>
body {
height: 200vh;
overflow: hidden;
}
::view-transition {
position: static;
display: block;
width: 100%;
height: 100%;
background: limegreen;
}
::view-transition-group(*),
::view-transition-image-pair(*),
::view-transition-old(*),
::view-transition-new(*) {
animation-play-state: paused;
}
</style>
<body></body>
"></iframe>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
// Start the view transition at a scroll offset so that the snapshot
// containing block differs from the initial containing block.
inner.contentWindow.scrollTo(0, 100);
await waitForAtLeastOneFrame();
const contentDocument = inner.contentDocument;
let vt = inner.contentDocument.startViewTransition();
await vt.ready;
takeScreenshot();
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>