summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_scroll_inactive_perspective.html
blob: da866c1ceaa040a2f8e6ce3a4f7b2b1d7550f205 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<head>
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Wheel-scrolling over inactive subframe with perspective</title>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript">

function* test(testDriver) {
  var subframe = document.getElementById('scroll');

  // scroll over the middle of the subframe, to make sure it scrolls,
  // not the page
  var scrollPos = subframe.scrollTop;
  yield moveMouseAndScrollWheelOver(subframe, 100, 100, testDriver);
  dump("after scroll, subframe.scrollTop = " + subframe.scrollTop + "\n");
  ok(subframe.scrollTop > scrollPos, "subframe scrolled after wheeling over it");
}

waitUntilApzStable()
.then(runContinuation(test))
.then(subtestDone);

  </script>
  <style>
    #scroll {
      width: 200px;
      height: 200px;
      overflow: scroll;
      perspective: 400px;
    }
    #scrolled {
      width: 200px;
      height: 1000px; /* so the subframe has room to scroll */
      background: linear-gradient(red, blue); /* so you can see it scroll */
      transform: translateZ(0px); /* so the perspective makes it to the display list */
    }
  </style>
</head>
<body>
  <div id="scroll">
    <div id="scrolled"></div>
  </div>
  <div style="height: 5000px;"></div><!-- So the page is scrollable as well -->
</body>
</head>