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/scoped/paint-order.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class=reftest-wait>
<head>
<link rel="match" href="paint-order-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/web-animations/testcommon.js"></script>
<style>
#scope {
position: relative; width: 200px; height: 100px;
background: white; contain: strict;
view-transition-name: none;
}
#part {
position: absolute; top: 10px; left: 10px;
width: 50px; height: 50px; background: #8cf;
z-index: 1; view-transition-name: foo;
}
#higher-nonpart {
position: absolute; top: 20px; left: 30px;
z-index: 2; width: 50px; height: 50px; background: #f88;
}
#lower-nonpart {
position: absolute; top: 40px; left: 20px;
z-index: -1; width: 50px; height: 50px; background: #a4f;
}
::view-transition { background: rgba(0, 0, 0, 0.1); }
::view-transition-group(*) { animation-play-state: paused; }
::view-transition-new(*) {
animation: unset; opacity: 1;
transform: translateX(40px) translateY(20px);
}
::view-transition-old(*) { animation: unset; opacity: 0; }
</style>
</head>
<body>
<div id=scope>
<div id=part></div>
<div id=higher-nonpart></div>
<div id=lower-nonpart></div>
</div>
<script>
const scope = document.querySelector("#scope");
failIfNot(scope.startViewTransition, "Missing element.startViewTransition");
async function runTest() {
await waitForCompositorReady();
scope.startViewTransition(() => requestAnimationFrame(takeScreenshot));
}
onload = () => runTest();
</script>
</body>
</html>