summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/squashing/squash-above-fixed-2.html
blob: 27ca06a96d5efb28c78fe40c770df2dca450eb1d (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html id="htmlTag">

<head>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
#fixed {
  -webkit-backface-visibility: hidden;
  position: fixed;
  z-index: 1;
  width: 400px;
  height: 200px;
  background-color: blue;
}

#compositedInsideFixed {
  -webkit-backface-visibility: hidden;
  width: 50px;
  height: 50px;
  background-color: red;
}

#container {
  position: absolute;
  z-index: 2;
  top: 50px;
  left: 100px;
  width: 200px;
  height: 4000px;
  background-color: cyan;
}

#description {
  position: absolute;
  top: 100px;
  left: 450px;
  width: 300px;
}

#testResults {
  display: none;
}

body {
  margin: 0;
}

</style>

<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    function runTest()
    {
        if (!window.internals)
            return;

        // Display the test results only after test is done so that it does not affect repaint rect results.
        document.getElementById('testResults').style.display = "block";
        // Case 1
        document.getElementById('Case1').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);

        // Case 2
        window.scrollTo(0, 80);
        runAfterLayoutAndPaint(function() {
          document.getElementById('Case2').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
          if (window.testRunner) {
            testRunner.notifyDone();
          }
        });
    }
</script>
</head>

<body onload="runTest()">
  <div id="description">
    <p>
      This scenario verifies that the cyan "container" element scrolls properly with squashing enabled.
      The "container" element should not squash into a composited layer mapping owned by the fixed
      position layer or its descendant, since this would make it behave like a fixed position
      element during composited scrolling.
    </p>
  </div>

  <div id="fixed">
    <div id="compositedInsideFixed"></div>
  </div>

  <div id="container"></div>

  <div id="testResults">
    CASE 1, original layer tree:
    <pre id="Case1"></pre>

    CASE 2, scrolling y to 80, the "container" element should remain positioned with respect to the scrolled document, the fixed-pos layer compensates for the new scroll position:
    <pre id="Case2"></pre>
  </div>

</body>
</html>