summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_hittest_backface_hidden.html
blob: 0e84282e54b85a97ded96418867042e4d2a2c329 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>APZ hit-testing with backface-visibility:hidden</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>
    body,html{
      height: 100%;
    }
    body{
      margin: 0;
      transform-style: preserve-3d;
    }
    #back, #front{
      backface-visibility: hidden;
      position: absolute;
      width: 100%;
      height: 100%
    }
    #front{
      overflow-y:auto;
    }
    #content{
      width: 100%;
      height: 200%;
      background: linear-gradient(blue, green);
    }
    #back{
      transform: rotateY(180deg);
    }
  </style>
</head>
<body>
  <div id="front">
    <div id="content"></div>
  </div>
  <div id="back"></div></body>
<script type="application/javascript">

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

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

  // Set a displayport to ensure the subframe is layerized.
  // This is not required for exercising the behavior we want to test,
  // but it's needed to be able to assert the results reliably.
  config.utils.setDisplayPortForElement(0, 0, 1000, 1000, subframe, 1);
  await promiseApzFlushedRepaints();

  var subframeViewId = config.utils.getViewId(subframe);

  var {scrollId} = hitTest(centerOf(subframe));

  is(scrollId, subframeViewId,
     "hit the scroll frame behind the backface-visibility:hidden element");
}

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

</script>
</html>