Automatic update from web-platform-tests new reftest Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> -- generate canvas regression test Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> -- wpt-commits: d8943e978103c68e07637ad6114e06c1fb0d86c6, a3f19d3119a36216eac2f0dd22bb23e0f0aa7d55 wpt-pr: 59780
43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
|
|
<meta charset="UTF-8">
|
|
<html class="reftest-wait">
|
|
<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 id='myWorker' type='text/worker'>
|
|
self.onmessage = function(e) {
|
|
const canvas = new OffscreenCanvas(200, 200);
|
|
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);
|
|
|
|
const bitmap = canvas.transferToImageBitmap();
|
|
self.postMessage(bitmap, bitmap);
|
|
};
|
|
</script>
|
|
<script>
|
|
const blob = new Blob([document.getElementById('myWorker').textContent]);
|
|
const worker = new Worker(URL.createObjectURL(blob));
|
|
worker.addEventListener('message', msg => {
|
|
const outputCtx = document.getElementById("canvas").getContext('2d');
|
|
outputCtx.drawImage(msg.data, 0, 0);
|
|
document.documentElement.classList.remove("reftest-wait");
|
|
});
|
|
worker.postMessage(null);
|
|
</script>
|
|
</html>
|