summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/canvas-with-object-fit-contain-in-composited-layer-expected.html
blob: fc70a9890d1081eed96107802aecc475deb6e174 (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
<!DOCTYPE html>
<style>
canvas {
  background-color: gray;
  width: 200px;
  height: 200px;
}
</style>
<p>Test passes if a green square inside an orange rectanlge is shown up without a distortion.
<div>
  <canvas width='200' height='200'></canvas>
</div>
<script>
function paintCanvas(canvas)
{
  var ctx = canvas.getContext('2d');
  ctx.fillStyle = 'orange';

  ctx.save();
  ctx.beginPath();
  ctx.rect(50, 0, 100, 200);
  ctx.clip();
  ctx.fillRect(0, 0, 200, 200);
  ctx.restore();

  ctx.fillStyle = 'green';
  ctx.fillRect(75, 75, 50, 50);
}

paintCanvas(document.querySelector('canvas'));
</script>