summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_hittest_bug1257288.html
blob: d9b813dddf13e09d252c2e5793fb0f11e422144e (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
66
67
68
69
70
71
72
73
74
<!DOCTYPE HTML>
<html>
<head>
  <title>A hit testing test for the scenario in bug 1257288</title>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <meta name="viewport" content="width=device-width"/>
  <style>
    html {
      background: radial-gradient(circle at 80px 450px, blue 5px, transparent 0) gray no-repeat;
      height: 100%;
    }

    #scrollbox {
      border: 1px solid black;
      width: 400px;
      height: 400px;
      margin: 20px;
      overflow: auto;
      background-color: white;
    }

    #scrolled {
      padding-top: 300px;
      padding-bottom: 300px;
    }

    #clip {
      overflow: hidden;
      margin: 10px;
    }

    #transform {
      background-color: red;
      width: 200px;
      height: 200px;
      will-change: transform;
      transform: rotate(45deg);
      position: relative;
      left: -100px;
    }
  </style>
</head>
<body>
  <div id="scrollbox">
    <div id="scrolled">
      <div id="clip">
        <div id="transform"></div>
      </div>
    </div>
  </div>
</body>
<script type="application/javascript">

async function test() {
  var config = getHitTestConfig();
  var utils = config.utils;

  // Check that hit-testing on the blue circle (located at (80, 450))
  // hits the root, not the subframe.
  checkHitResult(hitTest({x: 80, y: 450}),
                 APZHitResultFlags.VISIBLE,
                 utils.getViewId(document.scrollingElement),
                 utils.getLayersId(),
                 "root scroller should be hit, not subframe");
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);

</script>
</html>