summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/canvas-clip-stack-persistence-expected.html
blob: f0b6d1882860ad78f42a1a571164195377d59b76 (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
<!DOCTYPE html>
<html>
  <head>
    <title>Test that the clip state persists across frame boundaries.</title>
  </head>
  <body>
    <canvas id='canvas1' width='100' height='100'></canvas>
    <canvas id='canvas2' width='100' height='100'></canvas>
    <canvas id='canvas3' width='100' height='100'></canvas>
    <canvas id='canvas4' width='100' height='100'></canvas>
    <script>
      var canvas1 = document.getElementById('canvas1');
      var canvas2 = document.getElementById('canvas2');
      var canvas3 = document.getElementById('canvas3');
      var canvas4 = document.getElementById('canvas4');
      var ctx1 = canvas1.getContext('2d');
      var ctx2 = canvas2.getContext('2d');
      var ctx3 = canvas3.getContext('2d');
      var ctx4 = canvas4.getContext('2d');

      ctx1.fillStyle = 'green';
      ctx1.fillRect(0, 0, 100, 100);
      ctx1.beginPath();
      ctx1.moveTo(10, 10);
      ctx1.lineTo(90, 50);
      ctx1.lineTo(10, 90);
      ctx1.clip();
      ctx1.fillStyle = 'yellow';
      ctx1.fillRect(0, 0, 100, 100);

      ctx2.drawImage(canvas1, 0, 0);
      ctx2.fillStyle = 'green';
      ctx2.fillRect(0, 0, 50, 100);

      ctx3.drawImage(canvas1, 0, 0);

      // ctx4 transformed clip
      ctx4.fillStyle = 'green';
      ctx4.fillRect(0, 0, 10, 100);
      ctx4.drawImage(canvas1, 10, 0);
  
    </script>
  </body>
</html>