tor-browser

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

position-sticky-fixed-ancestor-iframe.html (1484B)


      1 <!DOCTYPE html>
      2 <html class='reftest-wait'>
      3 <title>Sticky elements inside fixed ancestors and iframe shouldn't account for scroll</title>
      4 <link rel="match" href="position-sticky-fixed-ancestor-iframe-ref.html" />
      5 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
      6 <link rel="help" href="https://crbug.com/1019142">
      7 <meta name="assert" content="This test checks that a sticky element inside a fixed subtree and iframe doesn't scroll with the viewport "/>
      8 
      9 <script src="/common/reftest-wait.js"></script>
     10 
     11 <style>
     12  body,html {
     13    margin: 0;
     14    width: 100%;
     15    height: 100%;
     16  }
     17 
     18  iframe {
     19    margin: 10px;
     20    width: 90%;
     21    height: 90%;
     22    border: 1px solid black;
     23  }
     24 
     25  .spacer {
     26    height: 120vh;
     27  }
     28 </style>
     29 
     30 <div class="spacer"></div>
     31 <iframe src="../resources/position-sticky-fixed-ancestor-iframe-child.html"></iframe>
     32 <div class="spacer"></div>
     33 
     34 <script>
     35  const child = document.querySelector('iframe');
     36  child.scrollIntoView();
     37  window.onload = () => {
     38    const childDoc = child.contentDocument;
     39    function toggleFixed() {
     40      childDoc.querySelector('.position-parent').classList.toggle('fixed');
     41    }
     42 
     43    childDoc.getElementById('button').addEventListener('click', toggleFixed);
     44 
     45    requestAnimationFrame(() => {
     46      childDoc.scrollingElement.scrollTop = childDoc.querySelector('.long').clientHeight;
     47      requestAnimationFrame(() => {
     48        toggleFixed();
     49        takeScreenshot();
     50      });
     51    });
     52  };
     53 </script>
     54 </html>