summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/animations/cross-fade-webkit-mask-box-image.html
blob: 40d7eb1002ffd2ce3263aa74d5f9e4bb1d9dbb7b (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
<html>
<head>
  <style>
    #box {
        position: absolute;
        left: 100px;
        top: 100px;
        height: 200px;
        width: 200px;
        background-color: red;
        -webkit-animation: anim 1s linear infinite;
    }
    #boxStatic {
        position: absolute;
        left: 100px;
        top: 300px;
        height: 200px;
        width: 200px;
        background-color: red;
        -webkit-mask-box-image: -webkit-cross-fade(url(resources/stripes-100.png), url(resources/green-100.png), 25%) 50 stretch;
    }
    @-webkit-keyframes anim {
        from { -webkit-mask-box-image: url(resources/stripes-100.png) 50 stretch; }
        to   { -webkit-mask-box-image: url(resources/green-100.png) 50 stretch; }
    }
  </style>
  <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
  // This test was flaky because it would start before the images were loaded.
  var imagesLoaded = 0;
  function imageLoaded() {
    ++imagesLoaded;
    if (imagesLoaded == 2) {
      const expectedValues = [
        // [time, element-id, property, expected-value, tolerance]
        [2.25, ["box", "boxStatic"], "webkitMaskBoxImage", 0.25, 0.05]
      ];
      var doPixelTest = true;
      var disablePauseAPI = false;
      var startTestImmediately = true;
      runAnimationTest(expectedValues, undefined, undefined, disablePauseAPI, doPixelTest, startTestImmediately);
    }
  }
  </script>
</head>
<body>
<img id="box" src="resources/green-100.png" onLoad="imageLoaded();"/>
<img id="boxStatic" src="resources/stripes-100.png" onLoad="imageLoaded();"/>
<div id="result"></div>
</body>
</html>