tor-browser

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

disable-apz-for-sle-pages.html (1929B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait reftest-snapshot-all reftest-no-flush" reftest-async-scroll
      3      reftest-async-scroll-y="200">
      4 <head>
      5  <title>Check that the apz.disable_for_sle_pages pref behaves as expected</title>
      6  <script>
      7    // Upon load, this page invokes scrollTo() for a transparent element
      8    // repeatedly. It triggers scroll events, which run the scroll listener
      9    // below. The scroll listener updates the background-position-x of the div
     10    // to make the div a scroll-linked-effect. The scroll-linked effect detector
     11    // should then report that the document contains such an effect, which will
     12    // disable APZ on the page. That in turn will cause the
     13    // reftest-async-scroll-y to get ignored, and that's what the reftest checks
     14    // for.
     15 
     16    function start() {
     17        let scrollPosition = 1;
     18 
     19        scroller.addEventListener('scroll', function() {
     20            // NOTE: Changing background-position-x doesn't change rendering for
     21            // this element.
     22            document.getElementById('scroll-linked-effect').style.backgroundPositionX =
     23                scroller.scrollTop + "px";
     24            if (scrollPosition == 1) {
     25              setTimeout(done, 0);
     26            }
     27            scrollPosition++;
     28            scroller.scrollTo(0, scrollPosition);
     29        });
     30 
     31        scroller.scrollTo(0, scrollPosition);
     32    }
     33    addEventListener('load', start, false);
     34 
     35    function done() {
     36        document.documentElement.classList.remove('reftest-wait');
     37    }
     38  </script>
     39 </head>
     40 <body style="height: 5000px; background-image:url(repeatable-diagonal-gradient.png);">
     41  <div id="scroller" style="overflow: auto; width: 100px; height: 100px; scrollbar-width: none;">
     42    <div style="height: 5000px;"></div>
     43  </div>
     44  <div id="scroll-linked-effect" style="position: absolute; top: 100px; left: 100px; width: 100px; height: 100px; background-color: green"></div>
     45 </body>
     46 </html>