<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:[email protected]">
<link rel="match" href="root-to-shared-animation-end-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
body, html { padding: 0; margin: 0 }
body {
background: lightgreen;
}
#box {
width: 400px;
height: 400px;
background: blue;
contain: paint;
}
.hidden {
contain: paint;
width: 10px;
height: 10px;
background: red;
view-transition-name: hidden;
}
html::view-transition-group(hidden) { animation-duration: 300s; }
html::view-transition-image-pair(hidden) { visibility: hidden; }
html::view-transition-group(root) { animation-duration: 0s; }
html::view-transition-new(*) { animation: unset; opacity: 0; }
html::view-transition-old(*) { animation: unset; opacity: 1; }
</style>
<div id=box></div>
<div class=hidden></div>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
document.startViewTransition(() => {
document.documentElement.style.viewTransitionName = "none";
document.body.style.background = "yellow";
box.style.viewTransitionName = "root";
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot));
});
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>