tor-browser

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

helper_touch_drag_root_scrollbar.html (1713B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <meta name="viewport" content="width=device-width; initial-scale=1.0">
      6  <title>Touch Drag on the viewport's scrollbar</title>
      7  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      8  <script type="application/javascript" src="apz_test_utils.js"></script>
      9  <script src="/tests/SimpleTest/paint_listener.js"></script>
     10  <style>
     11    .content {
     12      width: 1000px;
     13      height: 5000px;
     14    }
     15  </style>
     16  <script type="text/javascript">
     17 
     18 async function test() {
     19  let transformEndPromise = promiseTransformEnd();
     20  let scrollbarPresent = await promiseVerticalScrollbarTouchDrag(window, 20);
     21  if (!scrollbarPresent) {
     22    ok(true, "No scrollbar, can't do this test");
     23    return;
     24  }
     25 
     26  await transformEndPromise;
     27 
     28  // Flush everything just to be safe
     29  await promiseOnlyApzControllerFlushed();
     30 
     31  // After dragging the scrollbar 20px on a 1000px-high viewport, we should
     32  // have scrolled approx 2% of the 5000px high content. There might have been
     33  // scroll arrows and such so let's just have a minimum bound of 50px to be safe.
     34  ok(window.scrollY > 50, "Scrollbar drag resulted in a vertical scroll position of " + window.scrollY);
     35 
     36  // Check that we did not get spurious horizontal scrolling, as we might if the
     37  // drag gesture is mishandled by content as a select-drag rather than a scrollbar
     38  // drag.
     39  is(window.scrollX, 0, "Scrollbar drag resulted in a horizontal scroll position of " + window.scrollX);
     40 }
     41 
     42 waitUntilApzStable()
     43 .then(test)
     44 .then(subtestDone, subtestFailed);
     45 
     46  </script>
     47 </head>
     48 <body>
     49  <div class="content">Some content to ensure the root scrollframe is scrollable</div>
     50 </body>
     51 </html>