tor-browser

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

viewport-no-resize-event-on-overflow-recalc.html (1486B)


      1 <!doctype html>
      2 <html>
      3    <head>
      4        <title>Viewport: No Resize Event Fired on Overflow Recalc</title>
      5        <meta charset="utf-8">
      6        <meta name="viewport" content="width=device-width, minimum-scale=1">
      7        <script src="/resources/testharness.js"></script>
      8        <script src="/resources/testharnessreport.js"></script>
      9        <style>
     10          html {
     11              height: 100%;
     12          }
     13          body {
     14              /* Ensure overflow to start */
     15              height: 200%;
     16          }
     17        </style>
     18    </head>
     19    <body>
     20    <h1>No Resize Event Fired on Overflow Recalc</h1>
     21    <h4>
     22        Test Description: This test ensures we don't fire spurrious resize
     23        events when overflow is recalculated.
     24    </h4>
     25    <script>
     26      function runTest() {
     27        var t = async_test(
     28            "Resize event not fired at window.visualViewport when content is added");
     29        var viewResized = false;
     30        window.visualViewport.addEventListener('resize', function() {
     31            viewResized = true;
     32        });
     33 
     34        requestAnimationFrame(t.step_func_done(function() {
     35            assert_equals(viewResized, false);
     36        }));
     37 
     38        document.body.style.height = "400%";
     39      }
     40 
     41      // Run the test after load to make sure any resize from load doesn't
     42      // interfere.
     43      window.onload = requestAnimationFrame(function() {
     44        requestAnimationFrame(runTest);
     45      });
     46    </script>
     47    <div id="log"></div>
     48    </body>
     49 </html>