Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: element with content less than box size</title>
<link rel="author" href="mailto:khushalsagar@chromium.org">
<link rel="match" href="content-smaller-than-box-size-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
div { contain: paint; }
#target {
width: 100px;
height: 100px;
view-transition-name: target;
}
#inner {
width: 10px;
height: 10px;
background: blue;
position: relative;
top: 10px;
left: 10px;
}
.hidden {
background: pink;
width: 10px;
height: 10px;
view-transition-name: hidden;
}
html::view-transition-group(hidden) { animation-duration: 300s; }
html::view-transition-image-pair(hidden) { animation: unset; opacity: 0; }
html::view-transition-new(target) { animation: unset; opacity: 0; }
html::view-transition-old(target) { animation: unset; opacity: 1; }
</style>
<div id=target>
<div id=inner></div>
</div>
<div id=hidden class=hidden></div>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
document.startViewTransition(() => {
requestAnimationFrame(takeScreenshot);
});
}
onload = () => requestAnimationFrame(runTest);
</script>