summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/clip-change.html
blob: 6e8be7fc5185bf511a61de9def1a614efdcf7151 (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
<!DOCTYPE html>
<html>
<head>
  <script src="../resources/run-after-layout-and-paint.js"></script>
  <style>
    #indicator {
      position: absolute;
      top: 0px;
      left: 0px;
      height: 100px;
      width: 100px;
      background-color: red;
    }
    #clipper {
      transform:translateZ(0);
      position: absolute;
      top: 0px;
      left: 0px;
      height: 100px;
      width: 100px;
      background-color: green;
      clip: rect(25px, 75px, 75px, 25px);
    }
  </style>
  <script>
    if (window.testRunner) {
      testRunner.dumpAsTextWithPixelResults();
      testRunner.waitUntilDone();
    }
    function doTest() {
      runAfterLayoutAndPaint(function() {
        // The change in clip style should be reflected immediately in the size
        // of the composited clipper layer. After changing the clip, it should
        // entirely cover the indicator.
        var clipper = document.getElementById("clipper");
        clipper.style.clip = "rect(0px, 100px, 100px, 0px)";
        if (window.testRunner)
          testRunner.notifyDone();
      });
    }
    window.addEventListener("load", doTest, false);
  </script>
</head>
  <body>
    <div id="indicator"></div>
    <div id="clipper"></div>
  </body>
</html>