summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_hittest_sticky_bug1478304.html
blob: 395c688a122609f778c6b0d1443d84365caeb09e (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
<!DOCTYPE HTML>
<html>
<head>
  <title>APZ hit-testing with sticky element inside a transform (bug 1478304)</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>
    #subframe {
      width: 500px;
      height: 200px;
      overflow-y: auto;
    }
    #transform {
      transform: translate(0);
    }
    #sticky {
      background-color: white;
      position: sticky;
      top: 0;
    }
    #spacer {
      width: 100px;
      height: 1000px;
    }
    </style>
</head>
<body>
  <div id="subframe">
    <div id="transform">
      <div id="sticky">sticky with transformed parent (click me or hover me and try a scroll)</div>
      <div id="spacer"></div>
    </div>
  </div>
</body>
<script type="application/javascript">

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

  var subframe = document.getElementById("subframe");
  var sticky = document.getElementById("sticky");

  checkHitResult(
    hitTest(centerOf(sticky)),
    APZHitResultFlags.VISIBLE,
    utils.getViewId(subframe),
    utils.getLayersId(),
    "subframe was successfully hit");
}

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

</script>
</html>