tor-browser

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

helper_position_fixed_scroll_handoff-2.html (1727B)


      1 <!DOCTYPE HTML>
      2 <head>
      3  <title>APZ overscroll handoff for fixed elements</title>
      4  <script type="application/javascript" src="apz_test_utils.js"></script>
      5  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      6  <script src="/tests/SimpleTest/paint_listener.js"></script>
      7  <meta name="viewport" content="width=device-width"/>
      8 <style>
      9 html, body {
     10  margin: 0;
     11 }
     12 html {
     13  overflow: auto;
     14  background: blue;
     15 }
     16 .spacer {
     17  height: 2000px;
     18 }
     19 #fixed {
     20  position: fixed;
     21  overflow: auto;
     22  background: red;
     23  width: 200px;
     24  height: 200px;
     25  top: 0;
     26  left: 0;
     27 }
     28 </style>
     29 </head>
     30 <div id="fixed">
     31  <div class="spacer"></div>
     32 </div>
     33 <div class="spacer"></div>
     34 <script type="application/javascript">
     35 
     36 async function test() {
     37  // Scroll to the bottom of the fixed position element that should
     38  // allow overscroll handoff.
     39  fixed.scrollTop = fixed.scrollHeight;
     40 
     41  // After scrolling to bottom tick the refresh driver.
     42  await promiseFrame();
     43 
     44  info("Start: fixed=" + fixed.scrollTop + " window=" + window.scrollY);
     45 
     46  // Async scroll the fixed element by 200 pixels using the mouse-wheel.
     47  // This should handoff the overscroll to the window.
     48  await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200);
     49 
     50  // Make sure scrolling that has happened is propagated to the main thread.
     51  await promiseApzFlushedRepaints();
     52 
     53  // Try another gesture to ensure the overscroll handoff runs.
     54  await promiseMoveMouseAndScrollWheelOver(fixed, 50, 50, false, 200);
     55  await promiseApzFlushedRepaints();
     56 
     57  // Ensure that the window has scrolled.
     58  isnot(window.scrollY, 0, "The overscroll should not handoff");
     59 }
     60 
     61 waitUntilApzStable()
     62 .then(test)
     63 .then(subtestDone, subtestFailed);
     64 
     65 </script>