massive-element-below-viewport-partially-onscreen-new.html (2296B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <title>View transitions: massive element below viewport partially onscreen (new content)</title> 4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/"> 5 <link rel="author" href="mailto:khushalsagar@chromium.org"> 6 <link rel="match" href="massive-element-below-viewport-partially-onscreen-ref.html"> 7 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 8 <meta name="fuzzy" content="maxDifference=0-2;totalPixels=0-330"> 9 10 <script src="/common/reftest-wait.js"></script> 11 <style> 12 :root { 13 font: 12px/1 Ahem; 14 } 15 16 .target { 17 inline-size: 100px; 18 block-size: 40000px; 19 view-transition-name: target; 20 } 21 22 .top { 23 /* Ahem font sometimes causes slight differences between actual and reference 24 images due to anti-aliasing when bordering the white background in this 25 case. Adding a padding reduces the test flakiness. */ 26 padding-top: 1px; 27 inline-size: 100%; 28 block-size: 100px; 29 background: lightblue; 30 } 31 32 .middle { 33 inline-size: 100%; 34 block-size: 39800px; 35 background: green; 36 } 37 38 .bottom { 39 inline-size: 100%; 40 block-size: 100px; 41 background: blue; 42 } 43 44 .hidden { 45 contain: paint; 46 inline-size: 10px; 47 block-size: 10px; 48 background: grey; 49 view-transition-name: hidden; 50 } 51 52 html::view-transition-group(hidden) { animation-duration: 300s; } 53 html::view-transition-image-pair(hidden) { animation: unset; opacity: 0; } 54 55 html::view-transition-old(*), html::view-transition-new(*) { 56 object-fit: none; 57 } 58 59 html::view-transition-old(target) { animation: unset; opacity: 0; } 60 html::view-transition-new(target) { animation: unset; opacity: 1; } 61 62 </style> 63 64 <div class="target"> 65 <div class="top">This text is at the top of the box</div> 66 <div class="middle">This text is in the middle of the box</div> 67 <div id="scrollblue" class="bottom">This text is at the bottom of the box</div> 68 </div> 69 <div id=hidden class=hidden></div> 70 71 <script> 72 failIfNot(document.startViewTransition, "Missing document.startViewTransition"); 73 74 async function runTest() { 75 document.startViewTransition(() => { 76 requestAnimationFrame(() => requestAnimationFrame(() => 77 requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)) 78 )); 79 }); 80 } 81 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); 82 </script>