summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_hittest_clipped_fixed_modal.html
blob: 122863967afd4261e66e908e929127f20695b446 (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
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML>
<html>
<head>
  <title>Hit-testing on content covered by a fullscreen fixed-position item clipped away</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>
.modal
{
    position:fixed;
    z-index:10;
    width:100%;
    height:100%;
    left:0;
    top:0;
    clip:rect(1px,1px,1px,1px);
}
.modal__content
{
    overflow:auto;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
}
.modal__body
{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
}
.content
{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    overflow-y:auto
}
</style>
</head>
<body>
<div class="content">
 <div style="height: 5000px; background-image: linear-gradient(red,blue)">
    Filler to make the content div scrollable
 </div>
</div>
<div class="modal">
 <div class="modal__content">
  <div class="modal__body">
  </div>
 </div>
</div>
</body>
<script type="application/javascript">

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

  // layerize the scrollable frame
  var subframe = document.querySelector(".content");
  utils.setDisplayPortForElement(0, 0, 800, 2000, subframe, 1);
  await promiseApzFlushedRepaints();

  var target = document.querySelector(".content");
  checkHitResult(hitTest(centerOf(target)),
                 APZHitResultFlags.VISIBLE,
                 utils.getViewId(subframe),
                 utils.getLayersId(),
                 "content covered by a clipped fixed div");
}

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

</script>
</html>