summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/geometry/foreground-offset-change.html
blob: a8a2104dc57d58577185ea92e86ac09fd1578f10 (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
<html>
<head>
  <script src="../../resources/run-after-layout-and-paint.js"></script>
  <style>
    #clipper {
      width: 550px;
      height: 550px;
      overflow:hidden;
    }

    #trigger {
      /* Only overlap with the contents element, not the stretch element */
      transform:translateZ(0);
      position: absolute;
      top: 0px;
      left: 0px;
      width: 500px;
      height: 200px;
    }

    #container {
      /* Force compositing for this layer if any children get composited */
      transform:translate(0px, 1px);
    }

    #negative {
      /* Trigger foreground layer from container */
      z-index: -1;
      position: absolute;
    }

    #contents {
      /* foreground layer contents */
      width: 550px;
      height: 550px;
      background-color: green;
    }

    /* Move this element to stretch container to have a negative offset */
    #stretch {
      position: absolute;
      background-color: blue;
      top: 200px;
      left: -200px;
      width: 50px;
      height: 50px;
    }

  </style>
  <script>
    if (window.testRunner) {
      testRunner.waitUntilDone();
      testRunner.dumpAsTextWithPixelResults();
    }

    function doTest()
    {
      runAfterLayoutAndPaint(function() {
        document.getElementById("stretch").style.left = "-100px";
        if (window.testRunner)
          testRunner.notifyDone();
      });
    }

    window.addEventListener('load', doTest, false);
  </script>
</head>
<body>
  <div id="trigger"></div>
  <div id="clipper">
    <div id="container">
      <img id="contents">
      <div id="stretch"></div>
      <div id="negative"></div>
    </div>
  </div>
</body>