Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/path-objects/2d.path.clip.scale.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<link rel="match" href="2d.path.clip.scale-expected.html">
<title>Canvas test: 2d.path.clip.scale</title>
<h1>2d.path.clip.scale</h1>
<p class="desc">clip() with non-identity transform applies the correct clip region</p>
<canvas id="canvas" width="200" height="200">
<p class="fallback">FAIL (fallback content)</p>
</canvas>
<script>
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext('2d');
ctx.scale(2, 2);
ctx.beginPath();
ctx.rect(0, 0, 100, 200);
ctx.clip();
// Earlier in Servo, a regression was introduced.
// This only had fill the left half of square, as clip rect
// stored was not transformed.
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, 200, 200);
</script>