Source code
Revision control
Copy as Markdown
Other Tools
<head>
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Wheel-scrolling over inactive subframe with z-index</title>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript">
async function test() {
  var subframe = document.getElementById("scroll");
  // scroll over the middle of the subframe, and make sure that it scrolls,
  // not the page
  var scrollPos = subframe.scrollTop;
  await promiseMoveMouseAndScrollWheelOver(subframe, 100, 100);
  dump("after scroll, subframe.scrollTop = " + subframe.scrollTop + "\n");
  ok(subframe.scrollTop > scrollPos, "subframe scrolled after wheeling over it");
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
  </script>
  <style>
    #scroll {
      width: 200px;
      height: 200px;
      overflow: scroll;
    }
    #scrolled {
      width: 200px;
      height: 1000px; /* so the subframe has room to scroll */
      z-index: 2;
      background: linear-gradient(red, blue); /* so you can see it scroll */
      transform: translateZ(0px); /* to force active layers */
      will-change: transform; /* to force active layers */
    }
  </style>
</head>
<body>
  <div id="scroll">
    <div id="scrolled"></div>
  </div>
  <div style="height: 5000px;"></div><!-- So the page is scrollable as well -->
</body>