Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>View transitions: subpixel translation at start and end of transition</title>
<link rel="author" href="mailto:vmpstr@chromium.org">
<link rel="match" href="new-content-subpixel-last-frame-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<style>
body {
margin: 0;
background: white;
}
.box {
width: 100px;
height: 100px;
background: green;
position: fixed;
top: 0px;
left: 0px;
}
#box-end {
view-transition-name: box-end;
transform: translate(0px, 200px);
}
#box-end.dst {
transform: translate(50.5px, 250.5px);
}
html::view-transition-group(*) {
animation-duration: 300s;
animation-delay: -300s;
animation-play-state: paused;
}
html::view-transition-new(*) { animation: unset; opacity: 1; }
html::view-transition-old(*) { animation: unset; opacity: 0; }
html::view-transition-group(root) { animation: unset; opacity: 0; }
</style>
</head>
<body>
<div id="box-end" class="box"></div>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
const transition = document.startViewTransition(() => {
document.getElementById("box-end").classList.add("dst");
});
await transition.ready;
await waitForAtLeastOneFrame();
await waitForAtLeastOneFrame();
takeScreenshot();
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>
</body>
</html>