Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<link rel="match" href="2d.layer.shadow-from-outside-canvas.short-distance-with-clipping-expected.html">
<title>Canvas test: 2d.layer.shadow-from-outside-canvas.short-distance-with-clipping</title>
<h1>2d.layer.shadow-from-outside-canvas.short-distance-with-clipping</h1>
<p class="desc">Checks shadow produced by object drawn outside the canvas</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');
const delta = 1;
const clipRegion = new Path2D();
clipRegion.rect(20, 20, 160, 160);
ctx.clip(clipRegion);
ctx.beginLayer({filter: [
{name: 'dropShadow', dx: -(200 + delta),
dy: -(200 + delta), stdDeviation: 0,
floodColor: 'green'},
]});
ctx.fillStyle = 'red';
ctx.fillRect(200 + delta, 200 + delta, 100, 100);
ctx.endLayer();
</script>