summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/geometry/foreground-offset-change.html
blob: 550d65cdd6f83572a511e9ab24c63b611934de71 (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
<html>
<head>
  <style>
    #clipper {
      width: 550px;
      height: 550px;
      overflow:hidden;
    }

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

    #container {
      /* Force compositing for this layer if any children get composited */
      -webkit-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.dumpAsTextWithPixelResults();

    function doTest()
    {
      if (window.testRunner)
        testRunner.display();

      document.getElementById("stretch").style.left = "-100px";
    }

    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>