Chromium Code Reviews| Index: LayoutTests/compositing/canvas-with-object-fit-contain-in-composited-layer.html |
| diff --git a/LayoutTests/compositing/canvas-with-object-fit-contain-in-composited-layer.html b/LayoutTests/compositing/canvas-with-object-fit-contain-in-composited-layer.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ccf3d5abd44a9e4feb990b52214a38e93a65f7e4 |
| --- /dev/null |
| +++ b/LayoutTests/compositing/canvas-with-object-fit-contain-in-composited-layer.html |
| @@ -0,0 +1,31 @@ |
| +<!DOCTYPE html> |
| +<style> |
| +canvas { |
| + border: black 1px solid; |
| + background-color: gray; |
| + width: 200px; |
| + height: 200px; |
| + object-fit: contain; |
| +} |
| +</style> |
| +<p>Test passes if a green square inside a orange rectanlge is shown up without a distortion. |
| +<div> |
| + <canvas width="200" height="400"></canvas> |
| +</div> |
| +<script> |
| +function paintCanvas(canvas) |
| +{ |
| + var ctx = canvas.getContext('2d'); |
| + ctx.fillStyle = 'orange'; |
| + ctx.fillRect(0, 0, canvas.width, canvas.height); |
| + |
| + ctx.beginPath(); |
|
Justin Novosad
2015/06/09 19:20:44
This line is not needed IMHO
changseok
2015/06/11 05:46:47
Removed.
|
| + ctx.fillStyle = 'green'; |
| + var squarWidth = canvas.width / 2; |
| + var squarHalfWidth = squarWidth / 2; |
| + ctx.fillRect(canvas.width / 2 - squarHalfWidth, canvas.height / 2 - squarHalfWidth , squarWidth, squarWidth); |
| + ctx.fill(); |
|
Justin Novosad
2015/06/09 19:20:44
This one too.
changseok
2015/06/11 05:46:47
Done.
|
| +} |
| + |
| +paintCanvas(document.querySelector('canvas')); |
| +</script> |