tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scroll-timeline-frame-size-changed.html (1779B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <title>The default scroll() timeline when the frame size changed</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
      7                             the default scroll() timeline and update the
      8                             frame size">
      9 <link rel="match" href="scroll-timeline-frame-size-changed-ref.html">
     10 
     11 <style>
     12  @keyframes update {
     13    from { transform: translateY(0px); }
     14    to { transform: translateY(200px); }
     15  }
     16 
     17  html {
     18    min-height: 100%;
     19    padding-bottom: 100px;
     20  }
     21 
     22  #box {
     23    width: 100px;
     24    height: 100px;
     25    background-color: green;
     26    animation: update 1s linear;
     27    animation-timeline: scroll();
     28  }
     29 
     30  #covered {
     31    width: 100px;
     32    height: 100px;
     33    background-color: red;
     34  }
     35 
     36  * {
     37    margin-top: 0px;
     38    margin-bottom: 0px;
     39  }
     40 </style>
     41 
     42 <div id="box"></div>
     43 <div id="covered"></div>
     44 
     45 <script src="/web-animations/testcommon.js"></script>
     46 <script>
     47  document.documentElement.addEventListener('TestRendered', async () => {
     48    runTest();
     49  }, { once: true });
     50 
     51  async function runTest() {
     52    const scroller = document.scrollingElement;
     53 
     54    await waitForCompositorReady();
     55 
     56    // Move the scroller to the 25% point.
     57    const maxScroll = scroller.scrollHeight - scroller.clientHeight;
     58    scroller.scrollTop = 0.25 * maxScroll;
     59    await waitForNextFrame();
     60 
     61    // Update scroll range to make the current position become 50% point.
     62    scroller.style.paddingBottom = "50px";
     63    await waitForNextFrame();
     64 
     65    document.documentElement.classList.remove("reftest-wait");
     66  }
     67 </script>