diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html')
-rw-r--r-- | testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html b/testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html new file mode 100644 index 0000000000..1f218b4bd2 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/manual/filters/canvas-filter-shadow-and-properties-blur-expected.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<body> + <canvas id="canvas" width="300" height="300"></canvas> +</body> +<script> + /* + The shadow and shadow blur effects should be the same regardless if they were + defined with filters or properties. The blur parameter is set as double when + using the shadowBlur property since its uses havlf of the value set as the + standard deviation for the gaussian blur (https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-shadowblur-dev) + while the filter parameter is used directly as the standard deviation + (https://drafts.fxtf.org/filter-effects/#funcdef-filter-drop-shadow). The + fuzziness is defined with a maxDifference of 13 as to be the 5% of 256, since + the CSS spec defines the expected behavior in relation to an ideal Gaussian blur + with a tolerance of 5%. See: https://drafts.csswg.org/css-backgrounds-3/#shadow-blur. + */ + var canvas = document.getElementById('canvas'); + var ctx = canvas.getContext('2d'); + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowBlur = 4; + ctx.shadowColor = 'red'; + ctx.fillRect(20, 20, 50, 50); + ctx.shadowBlur = 8; + ctx.shadowColor = 'blue'; + ctx.fillRect(100, 20, 50, 50); + ctx.shadowBlur = 20; + ctx.shadowColor = 'yellow'; + ctx.fillRect(20, 100, 50, 50); + ctx.shadowBlur = 30; + ctx.shadowColor = 'cyan'; + ctx.fillRect(100, 100, 50, 50); +</script> |