tor-browser

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

overscroll-behavior-root.html (1684B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>overscroll-behavior in root works</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-actions.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <script src="/css/css-scroll-snap/support/common.js"></script>
     10 <link rel="help" href="https://drafts.csswg.org/css-overscroll-behavior">
     11 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=954423">
     12 
     13 <div style="height: 200vh"></div>
     14 
     15 <iframe srcdoc="<style>:root { overscroll-behavior-y: contain }</style><div style='height: 200vh'></div>"></iframe>
     16 
     17 <script>
     18 promise_test(async function() {
     19  await new Promise(r => window.addEventListener("load", r, { once: true }));
     20 
     21  const iframe = document.querySelector("iframe");
     22  iframe.scrollIntoView();
     23 
     24  const bounds = iframe.getBoundingClientRect();
     25 
     26  const originalScrollPos = window.scrollY;
     27 
     28  assert_equals(typeof originalScrollPos, "number", "Scroll position should be a number");
     29  assert_not_equals(originalScrollPos, 0, "Should have scrolled to get the iframe into view");
     30 
     31  await new test_driver.Actions()
     32    .scroll(Math.round(bounds.left + bounds.width / 2),
     33            Math.round(bounds.top + bounds.height / 2), 0, -100)
     34    .send();
     35 
     36  // Await two animation frames to give a chance to scroll.
     37  await new Promise(resolve => requestAnimationFrame(resolve));
     38  await new Promise(resolve => requestAnimationFrame(resolve));
     39 
     40  assert_equals(window.scrollY, originalScrollPos, "overscroll-behavior should work on the root");
     41 });
     42 </script>