scroll-timeline-default-print.tentative.html (1735B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <title>The default scroll() timeline for print</title> 4 <link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-notation"> 5 <link rel="help" href="https://drafts.csswg.org/css-animations-2/#animation-timeline"> 6 <meta name="assert" content="CSS animation correctly updates values when using the default scroll() timeline"> 7 <link rel="match" href="scroll-timeline-default-print-ref.html"> 8 9 <style> 10 @keyframes update { 11 from { transform: translateY(0px); } 12 to { transform: translateY(200px); } 13 } 14 15 html { 16 print-color-adjust: exact; 17 min-height: 100%; 18 padding-bottom: 100px; 19 } 20 21 #box { 22 width: 100px; 23 height: 100px; 24 background-color: green; 25 animation: update 1s linear; 26 animation-timeline: scroll(); 27 } 28 29 * { 30 margin-top: 0px; 31 margin-bottom: 0px; 32 } 33 </style> 34 35 <div id="box"></div> 36 <script src="/web-animations/testcommon.js"></script> 37 <script> 38 document.documentElement.addEventListener('TestRendered', async () => { 39 runTest(); 40 }, { once: true }); 41 42 async function runTest() { 43 const scroller = document.scrollingElement; 44 45 await waitForCompositorReady(); 46 47 // Move the scroller to the halfway point. 48 // When printing, a timeline associated with the document's scrolling 49 // element will become inactive. The root scroller is considered to be 50 // fully in view with a scroll range of zero. 51 // https://github.com/w3c/csswg-drafts/issues/8226 52 const maxScroll = scroller.scrollHeight - scroller.clientHeight; 53 scroller.scrollTop = 0.5 * maxScroll; 54 55 await waitForNextFrame(); 56 await waitForNextFrame(); 57 58 document.documentElement.classList.remove("reftest-wait"); 59 } 60 </script>