tor-browser

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

helper_bug1346632.html (2301B)


      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>Dragging the scrollbar on a page with a fixed-positioned element just past the right edge of the content</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    body {
     12      height: 2000px;
     13    }
     14    #fixed {
     15      width: 240px;
     16      height: 100%;
     17      position: fixed;
     18      top: 0px;
     19      right: -240px;
     20      z-index: 1000;
     21      overflow-y: scroll;
     22    }
     23    #fixed-content {
     24      height: 2000px;
     25    }
     26  </style>
     27  <script type="text/javascript">
     28 async function test() {
     29  var root = document.scrollingElement;
     30  var scrollPos = root.scrollTop;
     31  var scrollPromise = new Promise((resolve) => {
     32    document.addEventListener("scroll", () => {
     33      ok(root.scrollTop > scrollPos, "document scrolled after dragging scrollbar");
     34      resolve();
     35    }, {once: true});
     36  });
     37 
     38  if (window.innerWidth == root.clientWidth) {
     39    // No scrollbar, abort the test. This can happen e.g. on local macOS runs
     40    // with OS settings to only show scrollbars on trackpad/mouse activity.
     41    ok(false, "No scrollbars found, cannot run this test!");
     42    return;
     43  }
     44 
     45  var scrollbarX = (window.innerWidth + root.clientWidth) / 2;
     46  // Move the mouse to the scrollbar
     47  await promiseNativeMouseEventWithAPZ({
     48    target: root,
     49    offsetX: scrollbarX,
     50    offsetY: 100,
     51    type: "mousemove",
     52  });
     53  // mouse down
     54  await promiseNativeMouseEventWithAPZ({
     55    target: root,
     56    offsetX: scrollbarX,
     57    offsetY: 100,
     58    type: "mousedown",
     59  });
     60  // drag vertically
     61  await promiseNativeMouseEventWithAPZ({
     62    target: root,
     63    offsetX: scrollbarX,
     64    offsetY: 150,
     65    type: "mousemove",
     66  });
     67  // wait for the scroll listener to fire
     68  await scrollPromise;
     69  // and release
     70  await promiseNativeMouseEventWithAPZ({
     71    target: root,
     72    offsetX: scrollbarX,
     73    offsetY: 150,
     74    type: "mouseup",
     75  });
     76 }
     77 
     78 waitUntilApzStable()
     79 .then(test)
     80 .then(subtestDone, subtestFailed);
     81 
     82  </script>
     83 </head>
     84 <body>
     85  <div id="fixed">
     86    <p id="fixed-content"></p>
     87  </div>
     88 </body>
     89 </html>