summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_hittest_fixed_bg.html
blob: 1eae84305debf50782e2953d2632b64188c1df20 (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
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hit-testing of fixed background image</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>
  <style>
      html,
      body {
        height: 100vh;
        margin: 0px;
        padding: 0px;
        overflow-x: hidden;
      }
      .bg-gradient {
        background: linear-gradient(white, green) fixed;
        height: 1000px;
        width: 100%;
      }
  </style>
  </head>
  <body>
    <div class="bg-gradient"></div>
    <div style="height: 1000px; background-color: green;"></div>
  </body>
<script type="application/javascript">

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

  var body = document.querySelector("body");
  utils.setDisplayPortForElement(0, 0, 800, 2000, body, 1);
  await promiseApzFlushedRepaints();

  var target = document.querySelector(".bg-gradient");
  checkHitResult(hitTest(centerOf(target)),
                 APZHitResultFlags.VISIBLE,
                 utils.getViewId(body),
                 utils.getLayersId(),
                 "fixed bg image");
}

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

</script>
</html>
</html>