summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/test_bug1151667.html
blob: 88facf6e93264acb6191bf991aa8341ebe30a490 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1151667
-->
<head>
  <title>Test for Bug 1151667</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <style>
  #subframe {
    margin-top: 100px;
    height: 500px;
    width: 500px;
    overflow: scroll;
  }
  #subframe-content {
    height: 1000px;
    width: 500px;
    /* the background is so that we can see it scroll*/
    background: repeating-linear-gradient(#EEE, #EEE 100px, #DDD 100px, #DDD 200px);
  }
  #page-content {
    height: 5000px;
    width: 500px;
  }
  </style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151667">Mozilla Bug 1151667</a>
<p id="display"></p>
<div id="subframe">
  <!-- This makes sure the subframe is scrollable -->
  <div id="subframe-content"></div>
</div>
<!-- This makes sure the page is also scrollable, so it (rather than the subframe)
     is considered the primary async-scrollable frame, and so the subframe isn't
     layerized upon page load. -->
<div id="page-content"></div>
<pre id="test">
<script type="application/javascript;version=1.7">

function startTest() {
  var subframe = document.getElementById('subframe');
  synthesizeNativeWheelAndWaitForScrollEvent(subframe, 100, 150, 0, -10, continueTest);
}

function continueTest() {
  var subframe = document.getElementById('subframe');
  is(subframe.scrollTop > 0, true, "We should have scrolled the subframe down");
  is(document.documentElement.scrollTop, 0, "We should not have scrolled the page");
  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();
waitUntilApzStable().then(startTest);

</script>
</pre>
</body>
</html>