ancestor-display-change.html (1634B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <!-- 7 Accommodate slight color mismatch due to mix-blend-mode in cross fade and 8 rounding. 9 --> 10 <meta name="fuzzy" content="maxDifference=0-6;totalPixels=0-10000"> 11 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/"> 12 <link rel="match" href="ancestor-display-change-ref.html"> 13 </head> 14 <style> 15 .block { 16 background-color: blue; 17 margin: 10px; 18 height: 100px; 19 width: 100px; 20 } 21 #target { 22 view-transition-name: target; 23 } 24 .fade-out { 25 opacity: 0; 26 } 27 .flex { 28 display: flex; 29 } 30 ::view-transition-group(*), 31 ::view-transition-image-pair(*), 32 ::view-transition-old(*), 33 ::view-transition-new(*) { 34 /* freeze all animations at mid-point */ 35 animation-duration: 100000s; 36 animation-delay: -50000s; 37 animation-timing-function: cubic-bezier(0, 1, 1, 0); 38 } 39 </style> 40 <script src="/common/reftest-wait.js"></script> 41 <script src="/web-animations/testcommon.js"></script> 42 <body> 43 <div id="ancestor"> 44 <div id="scope" class="block"></div> 45 <div class="block"></div> 46 </div> 47 </body> 48 <script> 49 const scope = document.getElementById("scope"); 50 failIfNot(scope.startViewTransition, "Missing element.startViewTransition"); 51 52 window.onload = async () => { 53 await waitForCompositorReady(); 54 const vt = scope.startViewTransition(() => { 55 scope.classList.add('fade-out'); 56 }); 57 await vt.ready; 58 ancestor.classList.add('flex'); 59 requestAnimationFrame(takeScreenshot); 60 }; 61 </script> 62 </html>