scroll-timeline-inline-orientation.html (1845B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <title>Scroll timeline with inline orientation and root scroller</title> 4 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1"> 5 <link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-notation"> 6 <link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#descdef-scroll-timeline-orientation"> 7 <link rel="help" href="https://drafts.csswg.org/css-animations-2/#animation-timeline"> 8 <meta name="assert" content="CSS animation correctly updates values when using the inline orientation"> 9 <link rel="match" href="scroll-timeline-inline-orientation-ref.html"> 10 11 <style> 12 @keyframes update { 13 from { transform: translateX(0px); } 14 to { transform: translateX(200px); } 15 } 16 17 html { 18 min-width: 100%; 19 padding-right: 100px; 20 font-size: 0; 21 } 22 23 #box { 24 width: 100px; 25 height: 100px; 26 background-color: green; 27 animation: update 1s linear; 28 animation-timeline: scroll(inline root); 29 display: inline-block; 30 } 31 32 #covered { 33 width: 100px; 34 height: 100px; 35 background-color: red; 36 display: inline-block; 37 } 38 39 * { 40 margin-left: 0px; 41 margin-right: 0px; 42 } 43 </style> 44 45 <div id="box"></div> 46 <div id="covered"></div> 47 48 <script src="/web-animations/testcommon.js"></script> 49 <script> 50 document.documentElement.addEventListener('TestRendered', async () => { 51 runTest(); 52 }, { once: true }); 53 54 async function runTest() { 55 const scroller = document.scrollingElement; 56 57 await waitForCompositorReady(); 58 59 // Move the scroller to the halfway point. 60 const maxScroll = scroller.scrollWidth - scroller.clientWidth; 61 scroller.scrollLeft = 0.5 * maxScroll; 62 63 await waitForNextFrame(); 64 await waitForNextFrame(); 65 66 document.documentElement.classList.remove("reftest-wait"); 67 } 68 </script>