summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/html/canvas/offscreen
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen')
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html22
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js22
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html69
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js69
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html50
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html53
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.w.html54
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js62
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html53
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.w.html57
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js53
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html27
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html35
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.w.html50
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js40
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html43
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.w.html53
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js52
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html51
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html53
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.w.html54
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js62
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html48
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js48
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html320
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js320
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html56
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html56
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative-expected.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic-expected.html)4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.w.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.w.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative-expected.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x-expected.html)4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.w.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.w.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative-expected.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y-expected.html)4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.w.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.w.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative-expected.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only-expected.html)4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.w.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.w.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative-expected.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only-expected.html)4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.w.html (renamed from testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.w.html)6
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js4
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.worker.js33
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.html105
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.worker.js100
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete-expected.html50
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.w.html55
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma-expected.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.w.html58
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity-expected.html27
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.html37
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.w.html51
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear-expected.html44
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.html40
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.w.html54
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table-expected.html51
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.html41
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.w.html55
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.html61
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.worker.js56
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow-expected.html57
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html270
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js265
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.html97
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html111
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic-expected.html15
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.html24
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.w.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x-expected.html15
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.html24
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.w.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y-expected.html15
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.html24
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.w.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only-expected.html15
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.html24
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.w.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only-expected.html15
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.html24
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.w.html38
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.html131
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.worker.js126
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html25
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html46
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html32
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js27
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html19
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html31
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html45
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html20
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html31
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html45
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html27
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html34
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html48
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html29
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html36
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html50
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html1
-rw-r--r--testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html1
115 files changed, 4394 insertions, 826 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html
index d8f14529c5..e7461eacdb 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html
@@ -6,11 +6,11 @@
<script src="/html/canvas/resources/canvas-tests.js"></script>
<h1>2d.filter.canvasFilterObject.blur.exceptions.tentative</h1>
-<p class="desc">Test exceptions on CanvasFilter() blur.object</p>
+<p class="desc">Test exceptions on gaussianBlur filter</p>
<script>
-var t = async_test("Test exceptions on CanvasFilter() blur.object");
+var t = async_test("Test exceptions on gaussianBlur filter");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
@@ -20,12 +20,18 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur'}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: undefined}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: 'foo'}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: [1,2,3]}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: NaN}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: 'foo'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: [1,2,3]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: {}}); });
t.done();
});
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js
index 9b3fb3c04c..1c27168968 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js
@@ -1,12 +1,12 @@
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.blur.exceptions.tentative
-// Description:Test exceptions on CanvasFilter() blur.object
+// Description:Test exceptions on gaussianBlur filter
// Note:
importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");
-var t = async_test("Test exceptions on CanvasFilter() blur.object");
+var t = async_test("Test exceptions on gaussianBlur filter");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
@@ -16,12 +16,18 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur'}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: undefined}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: 'foo'}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: [1,2,3]}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: NaN}); });
- assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({name: 'gaussianBlur', stdDeviation: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: 'foo'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: [1,2,3]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'gaussianBlur', stdDeviation: {}}); });
t.done();
});
done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html
index 242094d9f9..0370c1387b 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html
@@ -6,11 +6,11 @@
<script src="/html/canvas/resources/canvas-tests.js"></script>
<h1>2d.filter.canvasFilterObject.colorMatrix.tentative</h1>
-<p class="desc">Test the functionality of ColorMatrix filters in CanvasFilter objects</p>
+<p class="desc">Test the functionality of ColorMatrix filters</p>
<script>
-var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects");
+var t = async_test("Test the functionality of ColorMatrix filters");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
@@ -20,38 +20,67 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: 'foo'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: undefined}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: 'foo'}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: null}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: [1, 2, 3]}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 'a']}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, Infinity]}); });
+
ctx.fillStyle = '#f00';
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 0});
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 0});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 90});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 90});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 180});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 180});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 270});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 270});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'saturate', values: 0.5});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'saturate', values: 0.5});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2);
+
ctx.clearRect(0, 0, 100, 50);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'luminanceToAlpha'});
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'luminanceToAlpha'});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', values: [
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0
- ]});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: [
+ 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0
+ ]});
ctx.fillRect(0, 0, 50, 25);
ctx.fillStyle = '#0f0';
ctx.fillRect(50, 0, 50, 25);
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js
index d214e1d836..62e4582efd 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js
@@ -1,12 +1,12 @@
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.colorMatrix.tentative
-// Description:Test the functionality of ColorMatrix filters in CanvasFilter objects
+// Description:Test the functionality of ColorMatrix filters
// Note:
importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");
-var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects");
+var t = async_test("Test the functionality of ColorMatrix filters");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
@@ -16,38 +16,67 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: 'foo'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: undefined}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: 'foo'}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: null}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: [1, 2, 3]}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 'a']}); });
+
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, Infinity]}); });
+
ctx.fillStyle = '#f00';
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 0});
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 0});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 255,0,0,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 90});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 90});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,91,0,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 180});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 180});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,109,109,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'hueRotate', values: 270});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'hueRotate', values: 270});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 109,18,255,255, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'saturate', values: 0.5});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'saturate', values: 0.5});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 155,27,27,255, 2);
+
ctx.clearRect(0, 0, 100, 50);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', type: 'luminanceToAlpha'});
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', type: 'luminanceToAlpha'});
ctx.fillRect(0, 0, 100, 50);
_assertPixelApprox(canvas, 10,10, 0,0,0,54, 2);
- ctx.filter = new CanvasFilter({name: 'colorMatrix', values: [
- 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0
- ]});
+
+ ctx.filter = new CanvasFilter(
+ {name: 'colorMatrix', values: [
+ 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0
+ ]});
ctx.fillRect(0, 0, 50, 25);
ctx.fillStyle = '#0f0';
ctx.fillRect(50, 0, 50, 25);
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html
new file mode 100644
index 0000000000..2b1c1c1c07
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getTransformedValue(C, V) {
+ // Get the right interval
+ const n = V.length;
+ const k = C == 1 ? n - 1 : Math.floor(C * n);
+ return V[k];
+ }
+
+ function getColor(inputColor, tableValues) {
+ const result = [0, 0, 0];
+ for (const i in inputColor) {
+ const C = inputColor[i]/255;
+ const Cprime = getTransformedValue(C, tableValues[i]);
+ result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
+ }
+ return result;
+ }
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(
+ color, [tableValuesR, tableValuesG, tableValuesB]);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html
index ff1de6bc9c..491d073efb 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html
@@ -1,42 +1,16 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/html/canvas/resources/canvas-tests.js"></script>
-
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</title>
<h1>2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</h1>
<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
-
-
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
<script>
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with discrete type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getTransformedValue(C, V) {
- // Get the right interval
- const n = V.length;
- const k = C == 1 ? n - 1 : Math.floor(C * n);
- return V[k];
- }
-
- function getColor(inputColor, tableValues) {
- const result = [0, 0, 0];
- for (const i in inputColor) {
- const C = inputColor[i]/255;
- const Cprime = getTransformedValue(C, tableValues[i]);
- result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
- }
- return result;
- }
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
tableValuesR = [0, 0, 1, 1];
tableValuesG = [2, 0, 0.5, 3];
@@ -55,13 +29,12 @@ t.step(function() {
[50, 68, 87],
];
- for (const color of inputColors) {
- let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]);
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
+ ctx.fillRect(i * 10, i * 10, 10, 10);
}
- t.done();
-});
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.w.html
new file mode 100644
index 0000000000..d3a999a242
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.w.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.discrete.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.discrete.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.filter = new CanvasFilter({name: 'componentTransfer',
+ funcR: {type: 'discrete', tableValues: tableValuesR},
+ funcG: {type: 'discrete', tableValues: tableValuesG},
+ funcB: {type: 'discrete', tableValues: tableValuesB},
+ });
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js
deleted file mode 100644
index 0e68f4899f..0000000000
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.discrete.tentative
-// Description:Test pixels on CanvasFilter() componentTransfer with discrete type
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with discrete type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getTransformedValue(C, V) {
- // Get the right interval
- const n = V.length;
- const k = C == 1 ? n - 1 : Math.floor(C * n);
- return V[k];
- }
-
- function getColor(inputColor, tableValues) {
- const result = [0, 0, 0];
- for (const i in inputColor) {
- const C = inputColor[i]/255;
- const Cprime = getTransformedValue(C, tableValues[i]);
- result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
- }
- return result;
- }
-
- tableValuesR = [0, 0, 1, 1];
- tableValuesG = [2, 0, 0.5, 3];
- tableValuesB = [1, -1, 5, 0];
- ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'discrete', tableValues: tableValuesR},
- funcG: {type: 'discrete', tableValues: tableValuesG},
- funcB: {type: 'discrete', tableValues: tableValuesB},
- });
-
- const inputColors = [
- [255, 255, 255],
- [0, 0, 0],
- [127, 0, 34],
- [252, 186, 3],
- [50, 68, 87],
- ];
-
- for (const color of inputColors) {
- let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]);
- ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
- }
- t.done();
-});
-done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html
new file mode 100644
index 0000000000..5adc9f53e2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getColor(inputColor, amplitude, exponent, offset) {
+ return [
+ Math.max(0, Math.min(1, Math.pow(inputColor[0]/255,
+ exponent[0]) * amplitude[0] + offset[0])) * 255,
+ Math.max(0, Math.min(1, Math.pow(inputColor[1]/255,
+ exponent[1]) * amplitude[1] + offset[1])) * 255,
+ Math.max(0, Math.min(1, Math.pow(inputColor[2]/255,
+ exponent[2]) * amplitude[2] + offset[2])) * 255,
+ ];
+ }
+
+ const amplitudes = [2, 1.1, 0.5];
+ const exponents = [5, 3, 1];
+ const offsets = [0.25, 0, 0.5];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(color, amplitudes, exponents, offsets);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html
index 64c30fc417..b262f3b1d3 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html
@@ -1,41 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/html/canvas/resources/canvas-tests.js"></script>
-
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</title>
<h1>2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</h1>
<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
-
-
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
<script>
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with gamma type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getColor(inputColor, amplitude, exponent, offset) {
- return [
- Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255,
- Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255,
- Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255,
- ];
- }
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
const amplitudes = [2, 1.1, 0.5];
const exponents = [5, 3, 1];
const offsets = [0.25, 0, 0.5];
ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]},
- funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]},
- funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]},
+ funcR: {type: 'gamma', amplitude: amplitudes[0],
+ exponent: exponents[0], offset: offsets[0]},
+ funcG: {type: 'gamma', amplitude: amplitudes[1],
+ exponent: exponents[1], offset: offsets[1]},
+ funcB: {type: 'gamma', amplitude: amplitudes[2],
+ exponent: exponents[2], offset: offsets[2]},
});
const inputColors = [
@@ -46,13 +32,12 @@ t.step(function() {
[50, 68, 87],
];
- for (const color of inputColors) {
- let outputColor = getColor(color, amplitudes, exponents, offsets);
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
+ ctx.fillRect(i * 10, i * 10, 10, 10);
}
- t.done();
-});
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.w.html
new file mode 100644
index 0000000000..1fe346eacf
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.w.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.gamma.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.gamma.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const amplitudes = [2, 1.1, 0.5];
+ const exponents = [5, 3, 1];
+ const offsets = [0.25, 0, 0.5];
+ ctx.filter = new CanvasFilter({name: 'componentTransfer',
+ funcR: {type: 'gamma', amplitude: amplitudes[0],
+ exponent: exponents[0], offset: offsets[0]},
+ funcG: {type: 'gamma', amplitude: amplitudes[1],
+ exponent: exponents[1], offset: offsets[1]},
+ funcB: {type: 'gamma', amplitude: amplitudes[2],
+ exponent: exponents[2], offset: offsets[2]},
+ });
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js
deleted file mode 100644
index d59bc699df..0000000000
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.gamma.tentative
-// Description:Test pixels on CanvasFilter() componentTransfer with gamma type
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with gamma type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getColor(inputColor, amplitude, exponent, offset) {
- return [
- Math.max(0, Math.min(1, Math.pow(inputColor[0]/255, exponent[0]) * amplitude[0] + offset[0])) * 255,
- Math.max(0, Math.min(1, Math.pow(inputColor[1]/255, exponent[1]) * amplitude[1] + offset[1])) * 255,
- Math.max(0, Math.min(1, Math.pow(inputColor[2]/255, exponent[2]) * amplitude[2] + offset[2])) * 255,
- ];
- }
-
- const amplitudes = [2, 1.1, 0.5];
- const exponents = [5, 3, 1];
- const offsets = [0.25, 0, 0.5];
- ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'gamma', amplitude: amplitudes[0], exponent: exponents[0], offset: offsets[0]},
- funcG: {type: 'gamma', amplitude: amplitudes[1], exponent: exponents[1], offset: offsets[1]},
- funcB: {type: 'gamma', amplitude: amplitudes[2], exponent: exponents[2], offset: offsets[2]},
- });
-
- const inputColors = [
- [255, 255, 255],
- [0, 0, 0],
- [127, 0, 34],
- [252, 186, 3],
- [50, 68, 87],
- ];
-
- for (const color of inputColors) {
- let outputColor = getColor(color, amplitudes, exponents, offsets);
- ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
- }
- t.done();
-});
-done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html
new file mode 100644
index 0000000000..895d531206
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.identity.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.identity.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ let outputColor = inputColors[i];
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html
index e0d628952e..26b6e4c702 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html
@@ -1,24 +1,15 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.identity.tentative</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/html/canvas/resources/canvas-tests.js"></script>
-
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.identity.tentative</title>
<h1>2d.filter.canvasFilterObject.componentTransfer.identity.tentative</h1>
<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
-
-
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
<script>
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
ctx.filter = new CanvasFilter({name: 'componentTransfer',
funcR: {type: 'identity'},
@@ -34,12 +25,12 @@ t.step(function() {
[50, 68, 87],
];
- for (const color of inputColors) {
- ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`,
- ctx.fillRect(0, 0, 10, 10);
- _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255);
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
}
- t.done();
-});
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.w.html
new file mode 100644
index 0000000000..d2216d1647
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.w.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.identity.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.identity.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.identity.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.filter = new CanvasFilter({name: 'componentTransfer',
+ funcR: {type: 'identity'},
+ funcG: {type: 'identity'},
+ funcB: {type: 'identity'},
+ });
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js
deleted file mode 100644
index 1b714b58ff..0000000000
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.identity.tentative
-// Description:Test pixels on CanvasFilter() componentTransfer with identity type
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'identity'},
- funcG: {type: 'identity'},
- funcB: {type: 'identity'},
- });
-
- const inputColors = [
- [255, 255, 255],
- [0, 0, 0],
- [127, 0, 34],
- [252, 186, 3],
- [50, 68, 87],
- ];
-
- for (const color of inputColors) {
- ctx.fillStyle = `rgba(${color[0]}, ${color[1]}, ${color[2]}, 1)`,
- ctx.fillRect(0, 0, 10, 10);
- _assertPixel(canvas, 5, 5, color[0],color[1],color[2],255);
- }
- t.done();
-});
-done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html
new file mode 100644
index 0000000000..c4ad790d56
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.linear.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getColor(inputColor, slopes, intercepts) {
+ return [
+ Math.max(0, Math.min(1,
+ inputColor[0]/255 * slopes[0] + intercepts[0])) * 255,
+ Math.max(0, Math.min(1,
+ inputColor[1]/255 * slopes[1] + intercepts[1])) * 255,
+ Math.max(0, Math.min(1,
+ inputColor[2]/255 * slopes[2] + intercepts[2])) * 255,
+ ];
+ }
+
+ const slopes = [0.5, 1.2, -0.2];
+ const intercepts = [0.25, 0, 0.5];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(color, slopes, intercepts);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html
index adbe557fd9..3fc3bd9eec 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html
@@ -1,33 +1,16 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/html/canvas/resources/canvas-tests.js"></script>
-
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative</title>
<h1>2d.filter.canvasFilterObject.componentTransfer.linear.tentative</h1>
<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
-
-
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
<script>
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with linear type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getColor(inputColor, slopes, intercepts) {
- return [
- Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255,
- Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255,
- Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255,
- ];
- }
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
const slopes = [0.5, 1.2, -0.2];
const intercepts = [0.25, 0, 0.5];
@@ -45,13 +28,12 @@ t.step(function() {
[50, 68, 87],
];
- for (const color of inputColors) {
- let outputColor = getColor(color, slopes, intercepts);
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
+ ctx.fillRect(i * 10, i * 10, 10, 10);
}
- t.done();
-});
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.w.html
new file mode 100644
index 0000000000..054dbce929
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.w.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.linear.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.linear.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const slopes = [0.5, 1.2, -0.2];
+ const intercepts = [0.25, 0, 0.5];
+ ctx.filter = new CanvasFilter({name: 'componentTransfer',
+ funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]},
+ funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]},
+ funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]},
+ });
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js
deleted file mode 100644
index fb2e01876f..0000000000
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.linear.tentative
-// Description:Test pixels on CanvasFilter() componentTransfer with linear type
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with linear type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getColor(inputColor, slopes, intercepts) {
- return [
- Math.max(0, Math.min(1, inputColor[0]/255 * slopes[0] + intercepts[0])) * 255,
- Math.max(0, Math.min(1, inputColor[1]/255 * slopes[1] + intercepts[1])) * 255,
- Math.max(0, Math.min(1, inputColor[2]/255 * slopes[2] + intercepts[2])) * 255,
- ];
- }
-
- const slopes = [0.5, 1.2, -0.2];
- const intercepts = [0.25, 0, 0.5];
- ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]},
- funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]},
- funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]},
- });
-
- const inputColors = [
- [255, 255, 255],
- [0, 0, 0],
- [127, 0, 34],
- [252, 186, 3],
- [50, 68, 87],
- ];
-
- for (const color of inputColors) {
- let outputColor = getColor(color, slopes, intercepts);
- ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
- }
- t.done();
-});
-done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html
new file mode 100644
index 0000000000..29e250614c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.table.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.table.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getTransformedValue(C, V) {
+ // Get the right interval
+ const n = V.length - 1;
+ const k = C == 1 ? n - 1 : Math.floor(C * n);
+ return V[k] + (C - k/n) * n * (V[k + 1] - V[k]);
+ }
+
+ function getColor(inputColor, tableValues) {
+ const result = [0, 0, 0];
+ for (const i in inputColor) {
+ const C = inputColor[i]/255;
+ const Cprime = getTransformedValue(C, tableValues[i]);
+ result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
+ }
+ return result;
+ }
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(
+ color, [tableValuesR, tableValuesG, tableValuesB]);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html
index 47048b68a1..ef2da126eb 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html
@@ -1,42 +1,16 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>OffscreenCanvas test: 2d.filter.canvasFilterObject.componentTransfer.table.tentative</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/html/canvas/resources/canvas-tests.js"></script>
-
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.table.tentative</title>
<h1>2d.filter.canvasFilterObject.componentTransfer.table.tentative</h1>
<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
-
-
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
<script>
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with table type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getTransformedValue(C, V) {
- // Get the right interval
- const n = V.length - 1;
- const k = C == 1 ? n - 1 : Math.floor(C * n);
- return V[k] + (C - k/n) * n * (V[k + 1] - V[k]);
- }
-
- function getColor(inputColor, tableValues) {
- const result = [0, 0, 0];
- for (const i in inputColor) {
- const C = inputColor[i]/255;
- const Cprime = getTransformedValue(C, tableValues[i]);
- result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
- }
- return result;
- }
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
tableValuesR = [0, 0, 1, 1];
tableValuesG = [2, 0, 0.5, 3];
@@ -55,13 +29,12 @@ t.step(function() {
[50, 68, 87],
];
- for (const color of inputColors) {
- let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]);
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
+ ctx.fillRect(i * 10, i * 10, 10, 10);
}
- t.done();
-});
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.w.html
new file mode 100644
index 0000000000..f39723da8e
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.w.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.canvasFilterObject.componentTransfer.table.tentative-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.canvasFilterObject.componentTransfer.table.tentative</title>
+<h1>2d.filter.canvasFilterObject.componentTransfer.table.tentative</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.filter = new CanvasFilter({name: 'componentTransfer',
+ funcR: {type: 'table', tableValues: tableValuesR},
+ funcG: {type: 'table', tableValues: tableValuesG},
+ funcB: {type: 'table', tableValues: tableValuesB},
+ });
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js
deleted file mode 100644
index 0799e73a58..0000000000
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
-// OffscreenCanvas test in a worker:2d.filter.canvasFilterObject.componentTransfer.table.tentative
-// Description:Test pixels on CanvasFilter() componentTransfer with table type
-// Note:
-
-importScripts("/resources/testharness.js");
-importScripts("/html/canvas/resources/canvas-tests.js");
-
-var t = async_test("Test pixels on CanvasFilter() componentTransfer with table type");
-var t_pass = t.done.bind(t);
-var t_fail = t.step_func(function(reason) {
- throw reason;
-});
-t.step(function() {
-
- var canvas = new OffscreenCanvas(100, 50);
- var ctx = canvas.getContext('2d');
-
- // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
- function getTransformedValue(C, V) {
- // Get the right interval
- const n = V.length - 1;
- const k = C == 1 ? n - 1 : Math.floor(C * n);
- return V[k] + (C - k/n) * n * (V[k + 1] - V[k]);
- }
-
- function getColor(inputColor, tableValues) {
- const result = [0, 0, 0];
- for (const i in inputColor) {
- const C = inputColor[i]/255;
- const Cprime = getTransformedValue(C, tableValues[i]);
- result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
- }
- return result;
- }
-
- tableValuesR = [0, 0, 1, 1];
- tableValuesG = [2, 0, 0.5, 3];
- tableValuesB = [1, -1, 5, 0];
- ctx.filter = new CanvasFilter({name: 'componentTransfer',
- funcR: {type: 'table', tableValues: tableValuesR},
- funcG: {type: 'table', tableValues: tableValuesG},
- funcB: {type: 'table', tableValues: tableValuesB},
- });
-
- const inputColors = [
- [255, 255, 255],
- [0, 0, 0],
- [127, 0, 34],
- [252, 186, 3],
- [50, 68, 87],
- ];
-
- for (const color of inputColors) {
- let outputColor = getColor(color, [tableValuesR, tableValuesG, tableValuesB]);
- ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
- ctx.fillRect(0, 0, 10, 10);
- _assertPixelApprox(canvas, 5, 5, outputColor[0],outputColor[1],outputColor[2],255, 2);
- }
- t.done();
-});
-done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html
index 301d11f888..08f8860e99 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html
@@ -20,23 +20,39 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', divisor: 2}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: 1}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: []}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [1]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[], []]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', divisor: 2}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: null}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: 1}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: []}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [1]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[], []]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); });
// This should not throw an error
- ctx.filter = new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[]]});
- ctx.filter = new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1]]});
t.done();
});
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js
index b4ce4d76b2..105ed67a75 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js
@@ -16,23 +16,39 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', divisor: 2}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: 1}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: []}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [1]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[], []]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', divisor: 2}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: null}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: 1}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: []}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [1]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[], []]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); });
// This should not throw an error
- ctx.filter = new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[]]});
- ctx.filter = new CanvasFilter({name: 'convolveMatrix', kernelMatrix: [[1]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'convolveMatrix', kernelMatrix: [[1]]});
t.done();
});
done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html
index 3e55e97e54..cdd501ba8e 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html
@@ -20,104 +20,250 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
+ // Should not throw an error.
// dx
- _assert(new CanvasFilter({name: 'dropShadow', dx: 10}), "new CanvasFilter({name: 'dropShadow', dx: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: -1}), "new CanvasFilter({name: 'dropShadow', dx: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: 0.5}), "new CanvasFilter({name: 'dropShadow', dx: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: null}), "new CanvasFilter({name: 'dropShadow', dx: null})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: true}), "new CanvasFilter({name: 'dropShadow', dx: true})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: false}), "new CanvasFilter({name: 'dropShadow', dx: false})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: []}), "new CanvasFilter({name: 'dropShadow', dx: []})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: [20]}), "new CanvasFilter({name: 'dropShadow', dx: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: '30'}), "new CanvasFilter({name: 'dropShadow', dx: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: '30'});
// dy
- _assert(new CanvasFilter({name: 'dropShadow', dy: 10}), "new CanvasFilter({name: 'dropShadow', dy: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: -1}), "new CanvasFilter({name: 'dropShadow', dy: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: 0.5}), "new CanvasFilter({name: 'dropShadow', dy: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: null}), "new CanvasFilter({name: 'dropShadow', dy: null})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: true}), "new CanvasFilter({name: 'dropShadow', dy: true})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: false}), "new CanvasFilter({name: 'dropShadow', dy: false})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: []}), "new CanvasFilter({name: 'dropShadow', dy: []})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: [20]}), "new CanvasFilter({name: 'dropShadow', dy: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: '30'}), "new CanvasFilter({name: 'dropShadow', dy: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: '30'});
// floodOpacity
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({name: 'dropShadow', floodOpacity: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({name: 'dropShadow', floodOpacity: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({name: 'dropShadow', floodOpacity: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: null}), "new CanvasFilter({name: 'dropShadow', floodOpacity: null})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: true}), "new CanvasFilter({name: 'dropShadow', floodOpacity: true})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: false}), "new CanvasFilter({name: 'dropShadow', floodOpacity: false})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: []}), "new CanvasFilter({name: 'dropShadow', floodOpacity: []})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({name: 'dropShadow', floodOpacity: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({name: 'dropShadow', floodOpacity: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: '30'});
+ // dx
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: '30'});
+ // dy
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: '30'});
+ // floodOpacity
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: '30'});
// stdDeviation
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({name: 'dropShadow', stdDeviation: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({name: 'dropShadow', stdDeviation: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({name: 'dropShadow', stdDeviation: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: null}), "new CanvasFilter({name: 'dropShadow', stdDeviation: null})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: true}), "new CanvasFilter({name: 'dropShadow', stdDeviation: true})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: false}), "new CanvasFilter({name: 'dropShadow', stdDeviation: false})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: []}), "new CanvasFilter({name: 'dropShadow', stdDeviation: []})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({name: 'dropShadow', stdDeviation: '30'})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [10, -1]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [0.5, null]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [true, false]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: ['30', ['40']]})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: '30'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [10, -1]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [0.5, null]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [true, false]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [[], [20]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: ['30', ['40']]});
// floodColor
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'red'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'canvas'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({name: 'dropShadow', floodColor: '#aabbccdd'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({name: 'dropShadow', floodColor: '#abcd'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'red'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'canvas'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: '#aabbccdd'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: '#abcd'});
+ // Should throw a TypeError.
// dx
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [1, 2]}); });
// dy
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [1, 2]}); });
// floodOpacity
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [1, 2]}); });
// stdDeviation
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, 2, 3]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, NaN]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, Infinity]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, -Infinity]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, undefined]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, 'test']}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, {}]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, [2, 3]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, 2, 3]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, NaN]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, -Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, undefined]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, 'test']}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, {}]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, [2, 3]]}); });
// floodColor
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 10}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 10}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: null}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: NaN}); });
t.done();
});
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js
index bd18524f28..1d56865e68 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js
@@ -16,104 +16,250 @@ t.step(function() {
var canvas = new OffscreenCanvas(100, 50);
var ctx = canvas.getContext('2d');
+ // Should not throw an error.
// dx
- _assert(new CanvasFilter({name: 'dropShadow', dx: 10}), "new CanvasFilter({name: 'dropShadow', dx: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: -1}), "new CanvasFilter({name: 'dropShadow', dx: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: 0.5}), "new CanvasFilter({name: 'dropShadow', dx: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: null}), "new CanvasFilter({name: 'dropShadow', dx: null})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: true}), "new CanvasFilter({name: 'dropShadow', dx: true})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: false}), "new CanvasFilter({name: 'dropShadow', dx: false})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: []}), "new CanvasFilter({name: 'dropShadow', dx: []})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: [20]}), "new CanvasFilter({name: 'dropShadow', dx: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', dx: '30'}), "new CanvasFilter({name: 'dropShadow', dx: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: '30'});
// dy
- _assert(new CanvasFilter({name: 'dropShadow', dy: 10}), "new CanvasFilter({name: 'dropShadow', dy: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: -1}), "new CanvasFilter({name: 'dropShadow', dy: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: 0.5}), "new CanvasFilter({name: 'dropShadow', dy: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: null}), "new CanvasFilter({name: 'dropShadow', dy: null})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: true}), "new CanvasFilter({name: 'dropShadow', dy: true})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: false}), "new CanvasFilter({name: 'dropShadow', dy: false})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: []}), "new CanvasFilter({name: 'dropShadow', dy: []})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: [20]}), "new CanvasFilter({name: 'dropShadow', dy: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', dy: '30'}), "new CanvasFilter({name: 'dropShadow', dy: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: '30'});
// floodOpacity
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: 10}), "new CanvasFilter({name: 'dropShadow', floodOpacity: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: -1}), "new CanvasFilter({name: 'dropShadow', floodOpacity: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: 0.5}), "new CanvasFilter({name: 'dropShadow', floodOpacity: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: null}), "new CanvasFilter({name: 'dropShadow', floodOpacity: null})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: true}), "new CanvasFilter({name: 'dropShadow', floodOpacity: true})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: false}), "new CanvasFilter({name: 'dropShadow', floodOpacity: false})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: []}), "new CanvasFilter({name: 'dropShadow', floodOpacity: []})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: [20]}), "new CanvasFilter({name: 'dropShadow', floodOpacity: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', floodOpacity: '30'}), "new CanvasFilter({name: 'dropShadow', floodOpacity: '30'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: '30'});
+ // dx
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: '30'});
+ // dy
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: '30'});
+ // floodOpacity
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: '30'});
// stdDeviation
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: 10}), "new CanvasFilter({name: 'dropShadow', stdDeviation: 10})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: -1}), "new CanvasFilter({name: 'dropShadow', stdDeviation: -1})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: 0.5}), "new CanvasFilter({name: 'dropShadow', stdDeviation: 0.5})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: null}), "new CanvasFilter({name: 'dropShadow', stdDeviation: null})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: true}), "new CanvasFilter({name: 'dropShadow', stdDeviation: true})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: false}), "new CanvasFilter({name: 'dropShadow', stdDeviation: false})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: []}), "new CanvasFilter({name: 'dropShadow', stdDeviation: []})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [20]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [\""+(20)+"\"]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: '30'}), "new CanvasFilter({name: 'dropShadow', stdDeviation: '30'})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [10, -1]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [10, -1]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [0.5, null]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [0.5, null]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [true, false]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [true, false]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: [[], [20]]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: [[], [\""+(20)+"\"]]})");
- _assert(new CanvasFilter({name: 'dropShadow', stdDeviation: ['30', ['40']]}), "new CanvasFilter({name: 'dropShadow', stdDeviation: ['30', ['40']]})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 10});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: -1});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 0.5});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: null});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: true});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: false});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: []});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [20]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: '30'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [10, -1]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [0.5, null]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [true, false]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [[], [20]]});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: ['30', ['40']]});
// floodColor
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'red'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'red'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'canvas'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'canvas'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}), "new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: '#aabbccdd'}), "new CanvasFilter({name: 'dropShadow', floodColor: '#aabbccdd'})");
- _assert(new CanvasFilter({name: 'dropShadow', floodColor: '#abcd'}), "new CanvasFilter({name: 'dropShadow', floodColor: '#abcd'})");
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'red'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'canvas'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: '#aabbccdd'});
+ ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: '#abcd'});
+ // Should throw a TypeError.
// dx
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dx: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dx: [1, 2]}); });
// dy
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', dy: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', dy: [1, 2]}); });
// floodOpacity
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodOpacity: [1, 2]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodOpacity: [1, 2]}); });
// stdDeviation
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: NaN}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: -Infinity}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: {}}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, 2, 3]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, NaN]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, Infinity]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, -Infinity]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, undefined]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, 'test']}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, {}]}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', stdDeviation: [1, [2, 3]]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: -Infinity}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: {}}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, 2, 3]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, NaN]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, -Infinity]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, undefined]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, 'test']}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, {}]}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', stdDeviation: [1, [2, 3]]}); });
// floodColor
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 'test'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: 10}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: undefined}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: null}); });
- assert_throws_js(TypeError, function() { new CanvasFilter({name: 'dropShadow', floodColor: NaN}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'test'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: 10}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: undefined}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: null}); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(
+ {name: 'dropShadow', floodColor: NaN}); });
t.done();
});
done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html
index 81eb1eae45..7569304b95 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html
@@ -22,86 +22,58 @@
// Parameter defaults.
ctx.filter = new CanvasFilter({name: 'dropShadow'});
ctx.fillRect(10, 10, 80, 80);
-
// All parameters specified.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
floodColor: 'purple', floodOpacity: 0.7});
ctx.fillRect(110, 10, 80, 80);
-
// Named color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'purple'});
ctx.fillRect(10, 110, 80, 80);
-
// System color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'LinkText'});
ctx.fillRect(110, 110, 80, 80);
-
// Numerical color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 1)'});
ctx.fillRect(210, 110, 80, 80);
-
// Transparent floodColor.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 0.7)'});
ctx.fillRect(310, 110, 80, 80);
-
// Transparent floodColor and floodOpacity.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7});
ctx.fillRect(410, 110, 80, 80);
-
// No blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
floodColor: 'purple'});
ctx.fillRect(10, 210, 80, 80);
-
// Single float blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
floodColor: 'purple'});
ctx.fillRect(110, 210, 80, 80);
-
// Single negative float blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
floodColor: 'purple'});
ctx.fillRect(210, 210, 80, 80);
-
// Two floats (X&Y) blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
floodColor: 'purple'});
ctx.fillRect(310, 210, 80, 80);
-
// Two negative floats (X&Y) blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
floodColor: 'purple'});
ctx.fillRect(410, 210, 80, 80);
-
// Degenerate parameter values.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
floodColor: 'purple', floodOpacity: [2]});
ctx.fillRect(10, 310, 80, 80);
-
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
floodColor: 'purple', floodOpacity: '0.8'});
ctx.fillRect(110, 310, 80, 80);
-
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
floodColor: 'purple', floodOpacity: ['0.4']});
ctx.fillRect(210, 310, 80, 80);
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html
index fe9087244a..2a26af4ec3 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html
@@ -24,86 +24,58 @@
// Parameter defaults.
ctx.filter = new CanvasFilter({name: 'dropShadow'});
ctx.fillRect(10, 10, 80, 80);
-
// All parameters specified.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
floodColor: 'purple', floodOpacity: 0.7});
ctx.fillRect(110, 10, 80, 80);
-
// Named color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'purple'});
ctx.fillRect(10, 110, 80, 80);
-
// System color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'LinkText'});
ctx.fillRect(110, 110, 80, 80);
-
// Numerical color.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 1)'});
ctx.fillRect(210, 110, 80, 80);
-
// Transparent floodColor.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 0.7)'});
ctx.fillRect(310, 110, 80, 80);
-
// Transparent floodColor and floodOpacity.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7});
ctx.fillRect(410, 110, 80, 80);
-
// No blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
floodColor: 'purple'});
ctx.fillRect(10, 210, 80, 80);
-
// Single float blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
floodColor: 'purple'});
ctx.fillRect(110, 210, 80, 80);
-
// Single negative float blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
floodColor: 'purple'});
ctx.fillRect(210, 210, 80, 80);
-
// Two floats (X&Y) blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
floodColor: 'purple'});
ctx.fillRect(310, 210, 80, 80);
-
// Two negative floats (X&Y) blur.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
floodColor: 'purple'});
ctx.fillRect(410, 210, 80, 80);
-
// Degenerate parameter values.
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
floodColor: 'purple', floodOpacity: [2]});
ctx.fillRect(10, 310, 80, 80);
-
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
floodColor: 'purple', floodOpacity: '0.8'});
ctx.fillRect(110, 310, 80, 80);
-
- ctx.filter = new CanvasFilter(
- {name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
+ ctx.filter = new CanvasFilter({name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
floodColor: 'purple', floodOpacity: ['0.4']});
ctx.fillRect(210, 310, 80, 80);
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative-expected.html
index f9571f208e..dac31c97f1 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic-expected.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative-expected.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</h1>
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<svg xmlns="http://www.w3.org/2000/svg"
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.html
index 4417a1917c..801e6fdb8c 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.w.html
index d2024ad205..6c7c7f7649 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative.w.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.isotropic</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.isotropic.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative-expected.html
index e76613271f..88d0cb2de2 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x-expected.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative-expected.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</h1>
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<svg xmlns="http://www.w3.org/2000/svg"
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.html
index 2ea26359fe..ba986d8e7b 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.w.html
index fa49ea4682..86fe086327 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative.w.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-x</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-x.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative-expected.html
index 0f214fca9f..744983d4ae 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y-expected.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative-expected.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</h1>
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<svg xmlns="http://www.w3.org/2000/svg"
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.html
index a9783ccb6a..0265cfa6c4 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.w.html
index ab83f50ea0..c22b320857 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative.w.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.mostly-y</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.mostly-y.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative-expected.html
index 285a641726..e611113e42 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only-expected.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative-expected.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</h1>
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<svg xmlns="http://www.w3.org/2000/svg"
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.html
index 3028c2a700..3ed8e9ddf9 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.w.html
index e8482cf3ed..35cbc1b365 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative.w.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.x-only</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.x-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative-expected.html
index d59945b5da..c6d915cb07 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only-expected.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative-expected.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</h1>
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<svg xmlns="http://www.w3.org/2000/svg"
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.html
index fca324716b..f563ad9d77 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.w.html
index 50cfb3083a..171a41caa8 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative.w.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
-<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only-expected.html">
-<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</title>
-<h1>2d.filter.canvasFilterObject.gaussianBlur.tentative.y-only</h1>
+<link rel="match" href="2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative-expected.html">
+<title>Canvas test: 2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</title>
+<h1>2d.filter.canvasFilterObject.gaussianBlur.y-only.tentative</h1>
<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
<canvas id="canvas" width="100" height="100">
<p class="fallback">FAIL (fallback content)</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html
index 040c62a96b..8ad2a5ccfb 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html
@@ -117,12 +117,12 @@ t.step(function() {
for (testCase of errorTestCases) {
const filterOptions = {...{name: 'turbulence'}, ...testCase};
- assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(filterOptions); });
}
for (testCase of workingTestCases) {
const filterOptions = {...{name: 'turbulence'}, ...testCase};
- _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null");
+ ctx.filter = new CanvasFilter(filterOptions);
}
t.done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js
index 1a950a9207..16199cb0ec 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js
@@ -113,12 +113,12 @@ t.step(function() {
for (testCase of errorTestCases) {
const filterOptions = {...{name: 'turbulence'}, ...testCase};
- assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); });
+ assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter(filterOptions); });
}
for (testCase of workingTestCases) {
const filterOptions = {...{name: 'turbulence'}, ...testCase};
- _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null");
+ ctx.filter = new CanvasFilter(filterOptions);
}
t.done();
});
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.html
new file mode 100644
index 0000000000..36dd856456
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.filter.layers.blur.exceptions</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.filter.layers.blur.exceptions</h1>
+<p class="desc">Test exceptions on gaussianBlur filter</p>
+
+
+<script>
+var t = async_test("Test exceptions on gaussianBlur filter");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: undefined}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: 'foo'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: [1,2,3]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: NaN}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: {}}}); });
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.worker.js
new file mode 100644
index 0000000000..a053b8113c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.blur.exceptions.worker.js
@@ -0,0 +1,33 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.filter.layers.blur.exceptions
+// Description:Test exceptions on gaussianBlur filter
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Test exceptions on gaussianBlur filter");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: undefined}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: 'foo'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: [1,2,3]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: NaN}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'gaussianBlur', stdDeviation: {}}}); });
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.html
new file mode 100644
index 0000000000..9e12acbbe0
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.filter.layers.colorMatrix</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.filter.layers.colorMatrix</h1>
+<p class="desc">Test the functionality of ColorMatrix filters</p>
+
+
+<script>
+var t = async_test("Test the functionality of ColorMatrix filters");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: undefined}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: 'foo'}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: null}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: [1, 2, 3]}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 'a']}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, Infinity]}}); });
+
+ ctx.fillStyle = '#f00';
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 0}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 90}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 180}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 270}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'saturate', values: 0.5}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 155,27,27,255, 2);
+
+ ctx.clearRect(0, 0, 100, 50);
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'luminanceToAlpha'}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: [
+ 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0
+ ]}});
+ ctx.fillRect(0, 0, 50, 25);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(50, 0, 50, 25);
+ ctx.fillStyle = '#00f';
+ ctx.fillRect(0, 25, 50, 25);
+ ctx.fillStyle = '#fff';
+ ctx.fillRect(50, 25, 50, 25);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 10,30, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 60,30, 0,255,0,255, 2);
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.worker.js
new file mode 100644
index 0000000000..12cdff3868
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.colorMatrix.worker.js
@@ -0,0 +1,100 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.filter.layers.colorMatrix
+// Description:Test the functionality of ColorMatrix filters
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Test the functionality of ColorMatrix filters");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: undefined}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: 'foo'}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: null}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: [1, 2, 3]}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 'a']}}); });
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'colorMatrix',
+ values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, Infinity]}}); });
+
+ ctx.fillStyle = '#f00';
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 0}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 90}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 180}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'hueRotate', values: 270}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'saturate', values: 0.5}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 155,27,27,255, 2);
+
+ ctx.clearRect(0, 0, 100, 50);
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', type: 'luminanceToAlpha'}});
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2);
+
+ ctx.beginLayer({filter:
+ {name: 'colorMatrix', values: [
+ 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0
+ ]}});
+ ctx.fillRect(0, 0, 50, 25);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(50, 0, 50, 25);
+ ctx.fillStyle = '#00f';
+ ctx.fillRect(0, 25, 50, 25);
+ ctx.fillStyle = '#fff';
+ ctx.fillRect(50, 25, 50, 25);
+ ctx.endLayer();
+ _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 10,30, 0,255,0,255, 2);
+ _assertPixelApprox(canvas, 60,30, 0,255,0,255, 2);
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete-expected.html
new file mode 100644
index 0000000000..8419953b3d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete-expected.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.componentTransfer.discrete</title>
+<h1>2d.filter.layers.componentTransfer.discrete</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getTransformedValue(C, V) {
+ // Get the right interval
+ const n = V.length;
+ const k = C == 1 ? n - 1 : Math.floor(C * n);
+ return V[k];
+ }
+
+ function getColor(inputColor, tableValues) {
+ const result = [0, 0, 0];
+ for (const i in inputColor) {
+ const C = inputColor[i]/255;
+ const Cprime = getTransformedValue(C, tableValues[i]);
+ result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
+ }
+ return result;
+ }
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(
+ color, [tableValuesR, tableValuesG, tableValuesB]);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.html
new file mode 100644
index 0000000000..459c2f2850
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.componentTransfer.discrete-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.discrete</title>
+<h1>2d.filter.layers.componentTransfer.discrete</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'discrete', tableValues: tableValuesR},
+ funcG: {type: 'discrete', tableValues: tableValuesG},
+ funcB: {type: 'discrete', tableValues: tableValuesB},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.w.html
new file mode 100644
index 0000000000..86e1d54fb7
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.discrete.w.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.componentTransfer.discrete-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.discrete</title>
+<h1>2d.filter.layers.componentTransfer.discrete</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with discrete type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'discrete', tableValues: tableValuesR},
+ funcG: {type: 'discrete', tableValues: tableValuesG},
+ funcB: {type: 'discrete', tableValues: tableValuesB},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma-expected.html
new file mode 100644
index 0000000000..3e5d980896
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma-expected.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.componentTransfer.gamma</title>
+<h1>2d.filter.layers.componentTransfer.gamma</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getColor(inputColor, amplitude, exponent, offset) {
+ return [
+ Math.max(0, Math.min(1, Math.pow(inputColor[0]/255,
+ exponent[0]) * amplitude[0] + offset[0])) * 255,
+ Math.max(0, Math.min(1, Math.pow(inputColor[1]/255,
+ exponent[1]) * amplitude[1] + offset[1])) * 255,
+ Math.max(0, Math.min(1, Math.pow(inputColor[2]/255,
+ exponent[2]) * amplitude[2] + offset[2])) * 255,
+ ];
+ }
+
+ const amplitudes = [2, 1.1, 0.5];
+ const exponents = [5, 3, 1];
+ const offsets = [0.25, 0, 0.5];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(color, amplitudes, exponents, offsets);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.html
new file mode 100644
index 0000000000..9012115adf
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.componentTransfer.gamma-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.gamma</title>
+<h1>2d.filter.layers.componentTransfer.gamma</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const amplitudes = [2, 1.1, 0.5];
+ const exponents = [5, 3, 1];
+ const offsets = [0.25, 0, 0.5];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'gamma', amplitude: amplitudes[0],
+ exponent: exponents[0], offset: offsets[0]},
+ funcG: {type: 'gamma', amplitude: amplitudes[1],
+ exponent: exponents[1], offset: offsets[1]},
+ funcB: {type: 'gamma', amplitude: amplitudes[2],
+ exponent: exponents[2], offset: offsets[2]},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.w.html
new file mode 100644
index 0000000000..767bcc58e5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.gamma.w.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.componentTransfer.gamma-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.gamma</title>
+<h1>2d.filter.layers.componentTransfer.gamma</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with gamma type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const amplitudes = [2, 1.1, 0.5];
+ const exponents = [5, 3, 1];
+ const offsets = [0.25, 0, 0.5];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'gamma', amplitude: amplitudes[0],
+ exponent: exponents[0], offset: offsets[0]},
+ funcG: {type: 'gamma', amplitude: amplitudes[1],
+ exponent: exponents[1], offset: offsets[1]},
+ funcB: {type: 'gamma', amplitude: amplitudes[2],
+ exponent: exponents[2], offset: offsets[2]},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity-expected.html
new file mode 100644
index 0000000000..9f1439f37b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity-expected.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.componentTransfer.identity</title>
+<h1>2d.filter.layers.componentTransfer.identity</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ let outputColor = inputColors[i];
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.html
new file mode 100644
index 0000000000..901dae3bed
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.componentTransfer.identity-expected.html">
+<title>Canvas test: 2d.filter.layers.componentTransfer.identity</title>
+<h1>2d.filter.layers.componentTransfer.identity</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'identity'},
+ funcG: {type: 'identity'},
+ funcB: {type: 'identity'},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.w.html
new file mode 100644
index 0000000000..2e45018755
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.identity.w.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.componentTransfer.identity-expected.html">
+<title>Canvas test: 2d.filter.layers.componentTransfer.identity</title>
+<h1>2d.filter.layers.componentTransfer.identity</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with identity type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'identity'},
+ funcG: {type: 'identity'},
+ funcB: {type: 'identity'},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear-expected.html
new file mode 100644
index 0000000000..f922055ff2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear-expected.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.componentTransfer.linear</title>
+<h1>2d.filter.layers.componentTransfer.linear</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getColor(inputColor, slopes, intercepts) {
+ return [
+ Math.max(0, Math.min(1,
+ inputColor[0]/255 * slopes[0] + intercepts[0])) * 255,
+ Math.max(0, Math.min(1,
+ inputColor[1]/255 * slopes[1] + intercepts[1])) * 255,
+ Math.max(0, Math.min(1,
+ inputColor[2]/255 * slopes[2] + intercepts[2])) * 255,
+ ];
+ }
+
+ const slopes = [0.5, 1.2, -0.2];
+ const intercepts = [0.25, 0, 0.5];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(color, slopes, intercepts);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.html
new file mode 100644
index 0000000000..f418b72ad5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.componentTransfer.linear-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.linear</title>
+<h1>2d.filter.layers.componentTransfer.linear</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const slopes = [0.5, 1.2, -0.2];
+ const intercepts = [0.25, 0, 0.5];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]},
+ funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]},
+ funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.w.html
new file mode 100644
index 0000000000..fbc29c86c1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.linear.w.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.componentTransfer.linear-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.linear</title>
+<h1>2d.filter.layers.componentTransfer.linear</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with linear type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ const slopes = [0.5, 1.2, -0.2];
+ const intercepts = [0.25, 0, 0.5];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'linear', slope: slopes[0], intercept: intercepts[0]},
+ funcG: {type: 'linear', slope: slopes[1], intercept: intercepts[1]},
+ funcB: {type: 'linear', slope: slopes[2], intercept: intercepts[2]},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table-expected.html
new file mode 100644
index 0000000000..0f6736d87d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table-expected.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.componentTransfer.table</title>
+<h1>2d.filter.layers.componentTransfer.table</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ // From https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement
+ function getTransformedValue(C, V) {
+ // Get the right interval
+ const n = V.length - 1;
+ const k = C == 1 ? n - 1 : Math.floor(C * n);
+ return V[k] + (C - k/n) * n * (V[k + 1] - V[k]);
+ }
+
+ function getColor(inputColor, tableValues) {
+ const result = [0, 0, 0];
+ for (const i in inputColor) {
+ const C = inputColor[i]/255;
+ const Cprime = getTransformedValue(C, tableValues[i]);
+ result[i] = Math.max(0, Math.min(1, Cprime)) * 255;
+ }
+ return result;
+ }
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ let outputColor = getColor(
+ color, [tableValuesR, tableValuesG, tableValuesB]);
+ ctx.fillStyle = `rgb(${outputColor[0]}, ${outputColor[1]},
+ ${outputColor[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.html
new file mode 100644
index 0000000000..ef5e0f847b
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.componentTransfer.table-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.table</title>
+<h1>2d.filter.layers.componentTransfer.table</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'table', tableValues: tableValuesR},
+ funcG: {type: 'table', tableValues: tableValuesG},
+ funcB: {type: 'table', tableValues: tableValuesB},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.w.html
new file mode 100644
index 0000000000..b11f0ef6f3
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.componentTransfer.table.w.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.componentTransfer.table-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-500">
+<title>Canvas test: 2d.filter.layers.componentTransfer.table</title>
+<h1>2d.filter.layers.componentTransfer.table</h1>
+<p class="desc">Test pixels on CanvasFilter() componentTransfer with table type</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ tableValuesR = [0, 0, 1, 1];
+ tableValuesG = [2, 0, 0.5, 3];
+ tableValuesB = [1, -1, 5, 0];
+ ctx.beginLayer({filter: {name: 'componentTransfer',
+ funcR: {type: 'table', tableValues: tableValuesR},
+ funcG: {type: 'table', tableValues: tableValuesG},
+ funcB: {type: 'table', tableValues: tableValuesB},
+ }});
+
+ const inputColors = [
+ [255, 255, 255],
+ [0, 0, 0],
+ [127, 0, 34],
+ [252, 186, 3],
+ [50, 68, 87],
+ ];
+
+ for (let i = 0 ; i < inputColors.length ; ++i) {
+ const color = inputColors[i];
+ ctx.fillStyle = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
+ ctx.fillRect(i * 10, i * 10, 10, 10);
+ }
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.html
new file mode 100644
index 0000000000..798822f104
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.filter.layers.convolveMatrix.exceptions</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.filter.layers.convolveMatrix.exceptions</h1>
+<p class="desc">Test exceptions on CanvasFilter() convolveMatrix</p>
+
+
+<script>
+var t = async_test("Test exceptions on CanvasFilter() convolveMatrix");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', divisor: 2}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: null}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: 1}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: []}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [1]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[], []]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}}); });
+ // This should not throw an error
+ ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[]]}});
+ ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1]]}});
+ ctx.endLayer();
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.worker.js
new file mode 100644
index 0000000000..fa3be89ba2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.convolveMatrix.exceptions.worker.js
@@ -0,0 +1,56 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.filter.layers.convolveMatrix.exceptions
+// Description:Test exceptions on CanvasFilter() convolveMatrix
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Test exceptions on CanvasFilter() convolveMatrix");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix'}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', divisor: 2}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: null}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: 1}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: []}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [1]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[], []]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1, 2], []]}}); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}}); });
+ // This should not throw an error
+ ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[]]}});
+ ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'convolveMatrix', kernelMatrix: [[1]]}});
+ ctx.endLayer();
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow-expected.html
new file mode 100644
index 0000000000..1719d99b4a
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow-expected.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.dropShadow</title>
+<h1>2d.filter.layers.dropShadow</h1>
+<p class="desc">Test CanvasFilter() dropShadow object.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width=520 height=420
+ color-interpolation-filters="sRGB">
+ <rect x=0 y=0 width=100% height=50 fill="teal" />
+ <rect x=0 y=100 width=100% height=50 fill="teal" />
+ <rect x=0 y=200 width=100% height=50 fill="teal" />
+ <rect x=0 y=300 width=100% height=50 fill="teal" />
+
+ <rect x=10 y=10 width=80 height=80 fill="crimson"
+ filter="drop-shadow(2px 2px 2px black)"/>
+ <rect x=110 y=10 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 5px rgba(128, 0, 128, 0.7))"/>
+
+ <rect x=10 y=110 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 3px purple)"/>
+ <rect x=110 y=110 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 3px LinkText)"/>
+ <rect x=210 y=110 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 3px rgba(20, 50, 130, 1))"/>
+ <rect x=310 y=110 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 3px rgba(20, 50, 130, 0.7))"/>
+ <rect x=410 y=110 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 3px rgba(20, 50, 130, 0.49))"/>
+
+ <rect x=10 y=210 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 0px purple)"/>
+ <rect x=110 y=210 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 5px purple)"/>
+ <rect x=210 y=210 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 0px purple)"/>
+ <filter id="separable-filter"
+ x="-100%" y="-100%" width="300%" height="300%">
+ <feDropShadow dx=9 dy=12 stdDeviation="3 5" flood-color="purple"/>
+ </filter>
+ <rect x=310 y=210 width=80 height=80 fill="crimson"
+ filter="url(#separable-filter)"/>
+ <rect x=410 y=210 width=80 height=80 fill="crimson"
+ filter="drop-shadow(9px 12px 0px purple)"/>
+
+ <rect x=10 y=310 width=80 height=80 fill="crimson"
+ filter="drop-shadow(-5px 0px 0px purple)"/>
+ <filter id="separable-filter-degenerate"
+ x="-100%" y="-100%" width="300%" height="300%">
+ <feDropShadow dx=0 dy=5 stdDeviation="0 3"
+ flood-color="rgba(128, 0, 128, 0.8)"/>
+ </filter>
+ <rect x=110 y=310 width=80 height=80 fill="crimson"
+ filter="url(#separable-filter-degenerate)"/>
+ <rect x=210 y=310 width=80 height=80 fill="crimson"
+ filter="drop-shadow(1px 10px 0px rgba(128, 0, 128, 0.4))"/>
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html
new file mode 100644
index 0000000000..10392dea5a
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html
@@ -0,0 +1,270 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.filter.layers.dropShadow.exceptions</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.filter.layers.dropShadow.exceptions</h1>
+<p class="desc">Test exceptions on CanvasFilter() dropShadow object</p>
+
+
+<script>
+var t = async_test("Test exceptions on CanvasFilter() dropShadow object");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Should not throw an error.
+ // dx
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: '30'}}); ctx.endLayer();
+ // dy
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: '30'}}); ctx.endLayer();
+ // floodOpacity
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer();
+ // dx
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: '30'}}); ctx.endLayer();
+ // dy
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: '30'}}); ctx.endLayer();
+ // floodOpacity
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer();
+ // stdDeviation
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: '30'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [10, -1]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [0.5, null]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [true, false]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [[], [20]]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: ['30', ['40']]}}); ctx.endLayer();
+ // floodColor
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'red'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'canvas'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: '#aabbccdd'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: '#abcd'}}); ctx.endLayer();
+
+ // Should throw a TypeError.
+ // dx
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [1, 2]}}); ctx.endLayer(); });
+ // dy
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [1, 2]}}); ctx.endLayer(); });
+ // floodOpacity
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [1, 2]}}); ctx.endLayer(); });
+ // stdDeviation
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, 2, 3]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, NaN]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, Infinity]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, -Infinity]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, undefined]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, 'test']}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, {}]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, [2, 3]]}}); ctx.endLayer(); });
+ // floodColor
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 10}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: null}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: NaN}}); ctx.endLayer(); });
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js
new file mode 100644
index 0000000000..86b8c56af6
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js
@@ -0,0 +1,265 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.filter.layers.dropShadow.exceptions
+// Description:Test exceptions on CanvasFilter() dropShadow object
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Test exceptions on CanvasFilter() dropShadow object");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ // Should not throw an error.
+ // dx
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: '30'}}); ctx.endLayer();
+ // dy
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: '30'}}); ctx.endLayer();
+ // floodOpacity
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer();
+ // dx
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: '30'}}); ctx.endLayer();
+ // dy
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: '30'}}); ctx.endLayer();
+ // floodOpacity
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer();
+ // stdDeviation
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: -1}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 0.5}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: null}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: true}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: false}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: []}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [20]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: '30'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [10, -1]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [0.5, null]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [true, false]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [[], [20]]}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: ['30', ['40']]}}); ctx.endLayer();
+ // floodColor
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'red'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'canvas'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'rgba(4, -3, 0.5, 1)'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: '#aabbccdd'}}); ctx.endLayer();
+ ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: '#abcd'}}); ctx.endLayer();
+
+ // Should throw a TypeError.
+ // dx
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dx: [1, 2]}}); ctx.endLayer(); });
+ // dy
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', dy: [1, 2]}}); ctx.endLayer(); });
+ // floodOpacity
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodOpacity: [1, 2]}}); ctx.endLayer(); });
+ // stdDeviation
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: NaN}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: -Infinity}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: {}}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, 2, 3]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, NaN]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, Infinity]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, -Infinity]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, undefined]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, 'test']}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, {}]}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', stdDeviation: [1, [2, 3]]}}); ctx.endLayer(); });
+ // floodColor
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'test'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 'rgba(NaN, 3, 2, 1)'}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: 10}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: undefined}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: null}}); ctx.endLayer(); });
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter:
+ {name: 'dropShadow', floodColor: NaN}}); ctx.endLayer(); });
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.html
new file mode 100644
index 0000000000..1ecf309fc4
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.dropShadow-expected.html">
+<title>Canvas test: 2d.filter.layers.dropShadow</title>
+<h1>2d.filter.layers.dropShadow</h1>
+<p class="desc">Test CanvasFilter() dropShadow object.</p>
+<canvas id="canvas" width="520" height="420">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(520, 420);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.fillRect(0, 0, 520, 50);
+ ctx.fillRect(0, 100, 520, 50);
+ ctx.fillRect(0, 200, 520, 50);
+ ctx.fillRect(0, 300, 520, 50);
+
+ ctx.fillStyle = 'crimson';
+
+ // Parameter defaults.
+ ctx.beginLayer({filter: {name: 'dropShadow'}});
+ ctx.fillRect(10, 10, 80, 80);
+ ctx.endLayer();
+ // All parameters specified.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ floodColor: 'purple', floodOpacity: 0.7}});
+ ctx.fillRect(110, 10, 80, 80);
+ ctx.endLayer();
+ // Named color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'purple'}});
+ ctx.fillRect(10, 110, 80, 80);
+ ctx.endLayer();
+ // System color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'LinkText'}});
+ ctx.fillRect(110, 110, 80, 80);
+ ctx.endLayer();
+ // Numerical color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 1)'}});
+ ctx.fillRect(210, 110, 80, 80);
+ ctx.endLayer();
+ // Transparent floodColor.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 0.7)'}});
+ ctx.fillRect(310, 110, 80, 80);
+ ctx.endLayer();
+ // Transparent floodColor and floodOpacity.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}});
+ ctx.fillRect(410, 110, 80, 80);
+ ctx.endLayer();
+ // No blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
+ floodColor: 'purple'}});
+ ctx.fillRect(10, 210, 80, 80);
+ ctx.endLayer();
+ // Single float blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ floodColor: 'purple'}});
+ ctx.fillRect(110, 210, 80, 80);
+ ctx.endLayer();
+ // Single negative float blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
+ floodColor: 'purple'}});
+ ctx.fillRect(210, 210, 80, 80);
+ ctx.endLayer();
+ // Two floats (X&Y) blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
+ floodColor: 'purple'}});
+ ctx.fillRect(310, 210, 80, 80);
+ ctx.endLayer();
+ // Two negative floats (X&Y) blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
+ floodColor: 'purple'}});
+ ctx.fillRect(410, 210, 80, 80);
+ ctx.endLayer();
+ // Degenerate parameter values.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
+ floodColor: 'purple', floodOpacity: [2]}});
+ ctx.fillRect(10, 310, 80, 80);
+ ctx.endLayer();
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
+ floodColor: 'purple', floodOpacity: '0.8'}});
+ ctx.fillRect(110, 310, 80, 80);
+ ctx.endLayer();
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
+ floodColor: 'purple', floodOpacity: ['0.4']}});
+ ctx.fillRect(210, 310, 80, 80);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html
new file mode 100644
index 0000000000..e73b573779
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.w.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.dropShadow-expected.html">
+<title>Canvas test: 2d.filter.layers.dropShadow</title>
+<h1>2d.filter.layers.dropShadow</h1>
+<p class="desc">Test CanvasFilter() dropShadow object.</p>
+<canvas id="canvas" width="520" height="420">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(520, 420);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.fillRect(0, 0, 520, 50);
+ ctx.fillRect(0, 100, 520, 50);
+ ctx.fillRect(0, 200, 520, 50);
+ ctx.fillRect(0, 300, 520, 50);
+
+ ctx.fillStyle = 'crimson';
+
+ // Parameter defaults.
+ ctx.beginLayer({filter: {name: 'dropShadow'}});
+ ctx.fillRect(10, 10, 80, 80);
+ ctx.endLayer();
+ // All parameters specified.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ floodColor: 'purple', floodOpacity: 0.7}});
+ ctx.fillRect(110, 10, 80, 80);
+ ctx.endLayer();
+ // Named color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'purple'}});
+ ctx.fillRect(10, 110, 80, 80);
+ ctx.endLayer();
+ // System color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'LinkText'}});
+ ctx.fillRect(110, 110, 80, 80);
+ ctx.endLayer();
+ // Numerical color.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 1)'}});
+ ctx.fillRect(210, 110, 80, 80);
+ ctx.endLayer();
+ // Transparent floodColor.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 0.7)'}});
+ ctx.fillRect(310, 110, 80, 80);
+ ctx.endLayer();
+ // Transparent floodColor and floodOpacity.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3,
+ floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}});
+ ctx.fillRect(410, 110, 80, 80);
+ ctx.endLayer();
+ // No blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 0,
+ floodColor: 'purple'}});
+ ctx.fillRect(10, 210, 80, 80);
+ ctx.endLayer();
+ // Single float blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: 5,
+ floodColor: 'purple'}});
+ ctx.fillRect(110, 210, 80, 80);
+ ctx.endLayer();
+ // Single negative float blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: -5,
+ floodColor: 'purple'}});
+ ctx.fillRect(210, 210, 80, 80);
+ ctx.endLayer();
+ // Two floats (X&Y) blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [3, 5],
+ floodColor: 'purple'}});
+ ctx.fillRect(310, 210, 80, 80);
+ ctx.endLayer();
+ // Two negative floats (X&Y) blur.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: 9, dy: 12, stdDeviation: [-3, -5],
+ floodColor: 'purple'}});
+ ctx.fillRect(410, 210, 80, 80);
+ ctx.endLayer();
+ // Degenerate parameter values.
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: [-5], dy: [], stdDeviation: null,
+ floodColor: 'purple', floodOpacity: [2]}});
+ ctx.fillRect(10, 310, 80, 80);
+ ctx.endLayer();
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: null, dy: '5', stdDeviation: [[-5], ['3']],
+ floodColor: 'purple', floodOpacity: '0.8'}});
+ ctx.fillRect(110, 310, 80, 80);
+ ctx.endLayer();
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false,
+ floodColor: 'purple', floodOpacity: ['0.4']}});
+ ctx.fillRect(210, 310, 80, 80);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic-expected.html
new file mode 100644
index 0000000000..4f93754862
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic-expected.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.gaussianBlur.isotropic</title>
+<h1>2d.filter.layers.gaussianBlur.isotropic</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="100" height="100"
+ color-interpolation-filters="sRGB">
+ <filter id="blur" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="4 4" />
+ </filter>
+ <rect x="25" y="25" width="50" height="50"
+ fill="teal" filter="url(#blur)" />
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.html
new file mode 100644
index 0000000000..50a98df1be
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.gaussianBlur.isotropic-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.isotropic</title>
+<h1>2d.filter.layers.gaussianBlur.isotropic</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.w.html
new file mode 100644
index 0000000000..a68b8e78a2
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.isotropic.w.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.gaussianBlur.isotropic-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.isotropic</title>
+<h1>2d.filter.layers.gaussianBlur.isotropic</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x-expected.html
new file mode 100644
index 0000000000..255270c192
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x-expected.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-x</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-x</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="100" height="100"
+ color-interpolation-filters="sRGB">
+ <filter id="blur" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="4 1" />
+ </filter>
+ <rect x="25" y="25" width="50" height="50"
+ fill="teal" filter="url(#blur)" />
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.html
new file mode 100644
index 0000000000..efc634796c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.gaussianBlur.mostly-x-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-x</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-x</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 1],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.w.html
new file mode 100644
index 0000000000..7d20d78503
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-x.w.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.gaussianBlur.mostly-x-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-x</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-x</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 1],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y-expected.html
new file mode 100644
index 0000000000..76a46b1533
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y-expected.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-y</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-y</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="100" height="100"
+ color-interpolation-filters="sRGB">
+ <filter id="blur" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="1 4" />
+ </filter>
+ <rect x="25" y="25" width="50" height="50"
+ fill="teal" filter="url(#blur)" />
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.html
new file mode 100644
index 0000000000..bdc6e66fe5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.gaussianBlur.mostly-y-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-y</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-y</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [1, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.w.html
new file mode 100644
index 0000000000..dfd6438b19
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.mostly-y.w.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.gaussianBlur.mostly-y-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.mostly-y</title>
+<h1>2d.filter.layers.gaussianBlur.mostly-y</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [1, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only-expected.html
new file mode 100644
index 0000000000..26741f9847
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only-expected.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.gaussianBlur.x-only</title>
+<h1>2d.filter.layers.gaussianBlur.x-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="100" height="100"
+ color-interpolation-filters="sRGB">
+ <filter id="blur" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="4 0" />
+ </filter>
+ <rect x="25" y="25" width="50" height="50"
+ fill="teal" filter="url(#blur)" />
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.html
new file mode 100644
index 0000000000..0d42acb8b5
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.gaussianBlur.x-only-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.x-only</title>
+<h1>2d.filter.layers.gaussianBlur.x-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 0],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.w.html
new file mode 100644
index 0000000000..b235c7ad38
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.x-only.w.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.gaussianBlur.x-only-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.x-only</title>
+<h1>2d.filter.layers.gaussianBlur.x-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [4, 0],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only-expected.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only-expected.html
new file mode 100644
index 0000000000..d00eec6b57
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only-expected.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.filter.layers.gaussianBlur.y-only</title>
+<h1>2d.filter.layers.gaussianBlur.y-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="100" height="100"
+ color-interpolation-filters="sRGB">
+ <filter id="blur" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="0 4" />
+ </filter>
+ <rect x="25" y="25" width="50" height="50"
+ fill="teal" filter="url(#blur)" />
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.html
new file mode 100644
index 0000000000..c9bc85d699
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.filter.layers.gaussianBlur.y-only-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.y-only</title>
+<h1>2d.filter.layers.gaussianBlur.y-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [0, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.w.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.w.html
new file mode 100644
index 0000000000..5deb96c255
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.gaussianBlur.y-only.w.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.filter.layers.gaussianBlur.y-only-expected.html">
+<title>Canvas test: 2d.filter.layers.gaussianBlur.y-only</title>
+<h1>2d.filter.layers.gaussianBlur.y-only</h1>
+<p class="desc">Test CanvasFilter() with gaussianBlur.</p>
+<canvas id="canvas" width="100" height="100">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 100);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'teal';
+ ctx.beginLayer({filter: {
+ name: 'gaussianBlur',
+ stdDeviation: [0, 4],
+ }});
+ ctx.fillRect(25, 25, 50, 50);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.html
new file mode 100644
index 0000000000..27f7748c84
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.html
@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.filter.layers.turbulence.inputTypes</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.filter.layers.turbulence.inputTypes</h1>
+<p class="desc">Test exceptions on CanvasFilter() turbulence object</p>
+
+
+<script>
+var t = async_test("Test exceptions on CanvasFilter() turbulence object");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ const errorTestCases = [
+ {baseFrequency: {}},
+ {baseFrequency: -1},
+ {baseFrequency: [0, -1]},
+ {baseFrequency: NaN},
+ {baseFrequency: Infinity},
+ {baseFrequency: undefined},
+ {baseFrequency: -Infinity},
+ {baseFrequency: 'test'},
+
+ {numOctaves: {}},
+ {numOctaves: -1},
+ {numOctaves: NaN},
+ {numOctaves: Infinity},
+ {numOctaves: undefined},
+ {numOctaves: -Infinity},
+ {numOctaves: [1, 1]},
+ {numOctaves: 'test'},
+
+ {seed: {}},
+ {seed: NaN},
+ {seed: Infinity},
+ {seed: undefined},
+ {seed: -Infinity},
+ {seed: [1, 1]},
+ {seed: 'test'},
+
+ {stitchTiles: {}},
+ {stitchTiles: NaN},
+ {stitchTiles: Infinity},
+ {stitchTiles: undefined},
+ {stitchTiles: -Infinity},
+ {stitchTiles: [1, 1]},
+ {stitchTiles: 'test'},
+ {stitchTiles: null},
+ {stitchTiles: []},
+ {stitchTiles: [10]},
+ {stitchTiles: 30},
+ {stitchTiles: false},
+ {stitchTiles: true},
+ {stitchTiles: '10'},
+ {stitchTiles: -1},
+
+ {type: {}},
+ {type: NaN},
+ {type: Infinity},
+ {type: undefined},
+ {type: -Infinity},
+ {type: [1, 1]},
+ {type: 'test'},
+ {type: null},
+ {type: []},
+ {type: [10]},
+ {type: 30},
+ {type: false},
+ {type: true},
+ {type: '10'},
+ {type: -1},
+ ]
+
+ // null and [] = 0 when parsed as number
+ const workingTestCases = [
+ {baseFrequency: null},
+ {baseFrequency: []},
+ {baseFrequency: [10]},
+ {baseFrequency: [10, 3]},
+ {baseFrequency: 30},
+ {baseFrequency: false},
+ {baseFrequency: true},
+ {baseFrequency: '10'},
+
+ {numOctaves: null},
+ {numOctaves: []},
+ {numOctaves: [10]},
+ {numOctaves: 30},
+ {numOctaves: false},
+ {numOctaves: true},
+ {numOctaves: '10'},
+
+ {seed: null},
+ {seed: []},
+ {seed: [10]},
+ {seed: 30},
+ {seed: false},
+ {seed: true},
+ {seed: '10'},
+ {seed: -1},
+
+ {stitchTiles: 'stitch'},
+ {stitchTiles: 'noStitch'},
+
+ {type: 'fractalNoise'},
+ {type: 'turbulence'},
+ ]
+
+ for (testCase of errorTestCases) {
+ const filterOptions = {...{name: 'turbulence'}, ...testCase};
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter: filterOptions}); });
+ }
+
+ for (testCase of workingTestCases) {
+ const filterOptions = {...{name: 'turbulence'}, ...testCase};
+ ctx.beginLayer({filter: filterOptions});
+ ctx.endLayer();
+ }
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.worker.js
new file mode 100644
index 0000000000..3728566c99
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.turbulence.inputTypes.worker.js
@@ -0,0 +1,126 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.filter.layers.turbulence.inputTypes
+// Description:Test exceptions on CanvasFilter() turbulence object
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Test exceptions on CanvasFilter() turbulence object");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ const errorTestCases = [
+ {baseFrequency: {}},
+ {baseFrequency: -1},
+ {baseFrequency: [0, -1]},
+ {baseFrequency: NaN},
+ {baseFrequency: Infinity},
+ {baseFrequency: undefined},
+ {baseFrequency: -Infinity},
+ {baseFrequency: 'test'},
+
+ {numOctaves: {}},
+ {numOctaves: -1},
+ {numOctaves: NaN},
+ {numOctaves: Infinity},
+ {numOctaves: undefined},
+ {numOctaves: -Infinity},
+ {numOctaves: [1, 1]},
+ {numOctaves: 'test'},
+
+ {seed: {}},
+ {seed: NaN},
+ {seed: Infinity},
+ {seed: undefined},
+ {seed: -Infinity},
+ {seed: [1, 1]},
+ {seed: 'test'},
+
+ {stitchTiles: {}},
+ {stitchTiles: NaN},
+ {stitchTiles: Infinity},
+ {stitchTiles: undefined},
+ {stitchTiles: -Infinity},
+ {stitchTiles: [1, 1]},
+ {stitchTiles: 'test'},
+ {stitchTiles: null},
+ {stitchTiles: []},
+ {stitchTiles: [10]},
+ {stitchTiles: 30},
+ {stitchTiles: false},
+ {stitchTiles: true},
+ {stitchTiles: '10'},
+ {stitchTiles: -1},
+
+ {type: {}},
+ {type: NaN},
+ {type: Infinity},
+ {type: undefined},
+ {type: -Infinity},
+ {type: [1, 1]},
+ {type: 'test'},
+ {type: null},
+ {type: []},
+ {type: [10]},
+ {type: 30},
+ {type: false},
+ {type: true},
+ {type: '10'},
+ {type: -1},
+ ]
+
+ // null and [] = 0 when parsed as number
+ const workingTestCases = [
+ {baseFrequency: null},
+ {baseFrequency: []},
+ {baseFrequency: [10]},
+ {baseFrequency: [10, 3]},
+ {baseFrequency: 30},
+ {baseFrequency: false},
+ {baseFrequency: true},
+ {baseFrequency: '10'},
+
+ {numOctaves: null},
+ {numOctaves: []},
+ {numOctaves: [10]},
+ {numOctaves: 30},
+ {numOctaves: false},
+ {numOctaves: true},
+ {numOctaves: '10'},
+
+ {seed: null},
+ {seed: []},
+ {seed: [10]},
+ {seed: 30},
+ {seed: false},
+ {seed: true},
+ {seed: '10'},
+ {seed: -1},
+
+ {stitchTiles: 'stitch'},
+ {stitchTiles: 'noStitch'},
+
+ {type: 'fractalNoise'},
+ {type: 'turbulence'},
+ ]
+
+ for (testCase of errorTestCases) {
+ const filterOptions = {...{name: 'turbulence'}, ...testCase};
+ assert_throws_js(TypeError, function() { ctx.beginLayer({filter: filterOptions}); });
+ }
+
+ for (testCase of workingTestCases) {
+ const filterOptions = {...{name: 'turbulence'}, ...testCase};
+ ctx.beginLayer({filter: filterOptions});
+ ctx.endLayer();
+ }
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html
new file mode 100644
index 0000000000..5fc1ac9acd
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.layer.ctm.filter</title>
+<h1>2d.layer.ctm.filter</h1>
+<p class="desc">Checks that parent transforms affect layer filters.</p>
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="200" height="200"
+ color-interpolation-filters="sRGB">
+ <filter id="filter" x="-100%" y="-100%" width="300%" height="300%">
+ <feDropShadow dx="5" dy="5" stdDeviation="0" flood-color="grey" />
+ </filter>
+
+ <g filter="url(#filter)">
+ <g transform="translate(30, 90) scale(2) rotate(90)">
+ <rect x="-30" y="-5" width=60 height=10></rect>
+ </g>
+ </g>
+
+ <g transform="translate(80, 90) scale(2) rotate(90)">
+ <g filter="url(#filter)">
+ <rect x="-30" y="-5" width=60 height=10></rect>
+ </g>
+ </g>
+</svg>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html
new file mode 100644
index 0000000000..e5efc24bcc
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.layer.ctm.filter-expected.html">
+<title>Canvas test: 2d.layer.ctm.filter</title>
+<h1>2d.layer.ctm.filter</h1>
+<p class="desc">Checks that parent transforms affect layer filters.</p>
+<canvas id="canvas" width="200" height="200">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(200, 200);
+ const ctx = canvas.getContext('2d');
+
+ // Transforms inside the layer should not apply to the layer's filter.
+ ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
+ ctx.translate(30, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+ ctx.fillRect(-30, -5, 60, 10);
+ ctx.endLayer();
+
+ // Transforms in the layer's parent should apply to the layer's filter.
+ ctx.translate(80, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+ ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
+ ctx.fillRect(-30, -5, 60, 10);
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html
new file mode 100644
index 0000000000..760a65e2c8
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.layer.ctm.filter-expected.html">
+<title>Canvas test: 2d.layer.ctm.filter</title>
+<h1>2d.layer.ctm.filter</h1>
+<p class="desc">Checks that parent transforms affect layer filters.</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');
+
+ // Transforms inside the layer should not apply to the layer's filter.
+ ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
+ ctx.translate(30, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+ ctx.fillRect(-30, -5, 60, 10);
+ ctx.endLayer();
+
+ // Transforms in the layer's parent should apply to the layer's filter.
+ ctx.translate(80, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+ ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'});
+ ctx.fillRect(-30, -5, 60, 10);
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html
new file mode 100644
index 0000000000..b2306d95ac
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>OffscreenCanvas test: 2d.layer.ctm.getTransform</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/canvas/resources/canvas-tests.js"></script>
+
+<h1>2d.layer.ctm.getTransform</h1>
+<p class="desc">Tests getTransform inside layers.</p>
+
+
+<script>
+var t = async_test("Tests getTransform inside layers.");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.translate(10, 20);
+ ctx.beginLayer();
+ ctx.scale(2, 3);
+ const m = ctx.getTransform();
+ assert_array_equals([m.a, m.b, m.c, m.d, m.e, m.f], [2, 0, 0, 3, 10, 20]);
+ ctx.endLayer();
+ t.done();
+
+});
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js
new file mode 100644
index 0000000000..54b1fee5d0
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js
@@ -0,0 +1,27 @@
+// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
+// OffscreenCanvas test in a worker:2d.layer.ctm.getTransform
+// Description:Tests getTransform inside layers.
+// Note:
+
+importScripts("/resources/testharness.js");
+importScripts("/html/canvas/resources/canvas-tests.js");
+
+var t = async_test("Tests getTransform inside layers.");
+var t_pass = t.done.bind(t);
+var t_fail = t.step_func(function(reason) {
+ throw reason;
+});
+t.step(function() {
+
+ var canvas = new OffscreenCanvas(100, 50);
+ var ctx = canvas.getContext('2d');
+
+ ctx.translate(10, 20);
+ ctx.beginLayer();
+ ctx.scale(2, 3);
+ const m = ctx.getTransform();
+ assert_array_equals([m.a, m.b, m.c, m.d, m.e, m.f], [2, 0, 0, 3, 10, 20]);
+ ctx.endLayer();
+ t.done();
+});
+done();
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html
new file mode 100644
index 0000000000..fd4c1746c7
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.layer.ctm.resetTransform</title>
+<h1>2d.layer.ctm.resetTransform</h1>
+<p class="desc">Tests resetTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 20, 20);
+
+ ctx.translate(40, 0);
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html
new file mode 100644
index 0000000000..9508b34044
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.layer.ctm.resetTransform-expected.html">
+<title>Canvas test: 2d.layer.ctm.resetTransform</title>
+<h1>2d.layer.ctm.resetTransform</h1>
+<p class="desc">Tests resetTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 50);
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(40, 0);
+
+ ctx.beginLayer();
+ ctx.rotate(2);
+ ctx.beginLayer();
+ ctx.scale(5, 6);
+ ctx.resetTransform();
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 20, 20);
+ ctx.endLayer();
+ ctx.endLayer();
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html
new file mode 100644
index 0000000000..7bf63e1473
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.layer.ctm.resetTransform-expected.html">
+<title>Canvas test: 2d.layer.ctm.resetTransform</title>
+<h1>2d.layer.ctm.resetTransform</h1>
+<p class="desc">Tests resetTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 50);
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(40, 0);
+
+ ctx.beginLayer();
+ ctx.rotate(2);
+ ctx.beginLayer();
+ ctx.scale(5, 6);
+ ctx.resetTransform();
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 20, 20);
+ ctx.endLayer();
+ ctx.endLayer();
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html
new file mode 100644
index 0000000000..45a3d095e1
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.layer.ctm.setTransform</title>
+<h1>2d.layer.ctm.setTransform</h1>
+<p class="desc">Tests setTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = document.getElementById("canvas");
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(80, 0);
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+
+ ctx.setTransform(4, 0, 0, 2, 20, 10);
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 10, 10);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html
new file mode 100644
index 0000000000..91034943b6
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.layer.ctm.setTransform-expected.html">
+<title>Canvas test: 2d.layer.ctm.setTransform</title>
+<h1>2d.layer.ctm.setTransform</h1>
+<p class="desc">Tests setTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(100, 50);
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(80, 0);
+
+ ctx.beginLayer();
+ ctx.rotate(2);
+ ctx.beginLayer();
+ ctx.scale(5, 6);
+ ctx.setTransform(4, 0, 0, 2, 20, 10);
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 10, 10);
+ ctx.endLayer();
+ ctx.endLayer();
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html
new file mode 100644
index 0000000000..8b1ea1ce51
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.layer.ctm.setTransform-expected.html">
+<title>Canvas test: 2d.layer.ctm.setTransform</title>
+<h1>2d.layer.ctm.setTransform</h1>
+<p class="desc">Tests setTransform inside layers.</p>
+<canvas id="canvas" width="100" height="50">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script id='myWorker' type='text/worker'>
+ self.onmessage = function(e) {
+ const canvas = new OffscreenCanvas(100, 50);
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(80, 0);
+
+ ctx.beginLayer();
+ ctx.rotate(2);
+ ctx.beginLayer();
+ ctx.scale(5, 6);
+ ctx.setTransform(4, 0, 0, 2, 20, 10);
+ ctx.fillStyle = 'blue';
+ ctx.fillRect(0, 0, 10, 10);
+ ctx.endLayer();
+ ctx.endLayer();
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 20, 20);
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html
new file mode 100644
index 0000000000..312ca19b4c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title>
+<h1>2d.layer.ctm.shadow-in-transformed-layer</h1>
+<p class="desc">Check shadows inside of a transformed layer.</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.translate(80, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+
+ ctx.shadowOffsetX = 10;
+ ctx.shadowOffsetY = 10;
+ ctx.shadowColor = 'grey';
+ ctx.fillRect(-30, -5, 60, 10);
+
+ const canvas2 = new OffscreenCanvas(100, 100);
+ const ctx2 = canvas2.getContext('2d');
+ ctx2.fillStyle = 'blue';
+ ctx2.fillRect(0, 0, 40, 10);
+ ctx.drawImage(canvas2, -30, -30);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html
new file mode 100644
index 0000000000..59305076f0
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html">
+<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title>
+<h1>2d.layer.ctm.shadow-in-transformed-layer</h1>
+<p class="desc">Check shadows inside of a transformed layer.</p>
+<canvas id="canvas" width="200" height="200">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(200, 200);
+ const ctx = canvas.getContext('2d');
+
+ ctx.translate(80, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+
+ ctx.beginLayer();
+ ctx.shadowOffsetX = 10;
+ ctx.shadowOffsetY = 10;
+ ctx.shadowColor = 'grey';
+ ctx.fillRect(-30, -5, 60, 10);
+
+ const canvas2 = new OffscreenCanvas(100, 100);
+ const ctx2 = canvas2.getContext('2d');
+ ctx2.fillStyle = 'blue';
+ ctx2.fillRect(0, 0, 40, 10);
+ ctx.drawImage(canvas2, -30, -30);
+
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html
new file mode 100644
index 0000000000..486a028335
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html">
+<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title>
+<h1>2d.layer.ctm.shadow-in-transformed-layer</h1>
+<p class="desc">Check shadows inside of a transformed layer.</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.translate(80, 90);
+ ctx.scale(2, 2);
+ ctx.rotate(Math.PI / 2);
+
+ ctx.beginLayer();
+ ctx.shadowOffsetX = 10;
+ ctx.shadowOffsetY = 10;
+ ctx.shadowColor = 'grey';
+ ctx.fillRect(-30, -5, 60, 10);
+
+ const canvas2 = new OffscreenCanvas(100, 100);
+ const ctx2 = canvas2.getContext('2d');
+ ctx2.fillStyle = 'blue';
+ ctx2.fillRect(0, 0, 40, 10);
+ ctx.drawImage(canvas2, -30, -30);
+
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html
new file mode 100644
index 0000000000..26f6e75214
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<title>Canvas test: 2d.layer.drawImage</title>
+<h1>2d.layer.drawImage</h1>
+<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</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.fillStyle = 'skyblue';
+ ctx.fillRect(0, 0, 100, 100);
+
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10,
+ stdDeviation: 0, floodColor: 'navy'}});
+
+ ctx.fillStyle = 'maroon';
+ ctx.fillRect(20, 20, 50, 50);
+
+ ctx.globalCompositeOperation = 'xor';
+
+ // Should xor only with the layer content, not the parents'.
+ ctx.fillStyle = 'pink';
+ ctx.fillRect(40, 40, 50, 50);
+
+ ctx.endLayer();
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html
new file mode 100644
index 0000000000..37718f6f2c
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<link rel="match" href="2d.layer.drawImage-expected.html">
+<title>Canvas test: 2d.layer.drawImage</title>
+<h1>2d.layer.drawImage</h1>
+<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p>
+<canvas id="canvas" width="200" height="200">
+ <p class="fallback">FAIL (fallback content)</p>
+</canvas>
+<script>
+ const canvas = new OffscreenCanvas(200, 200);
+ const ctx = canvas.getContext('2d');
+
+ ctx.fillStyle = 'skyblue';
+ ctx.fillRect(0, 0, 100, 100);
+
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10,
+ stdDeviation: 0, floodColor: 'navy'}});
+
+ ctx.fillStyle = 'maroon';
+ ctx.fillRect(20, 20, 50, 50);
+
+ ctx.globalCompositeOperation = 'xor';
+
+ // The image should xor only with the layer content, not the parents'.
+ const canvas_image = new OffscreenCanvas(200,200);
+ const ctx_image = canvas_image.getContext("2d");
+ ctx_image.fillStyle = 'pink';
+ ctx_image.fillRect(40, 40, 50, 50);
+ ctx.drawImage(canvas_image, 0, 0);
+
+ ctx.endLayer();
+
+ const outputCanvas = document.getElementById("canvas");
+ outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
+</script>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html
new file mode 100644
index 0000000000..78a235597d
--- /dev/null
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
+<html class="reftest-wait">
+<link rel="match" href="2d.layer.drawImage-expected.html">
+<title>Canvas test: 2d.layer.drawImage</title>
+<h1>2d.layer.drawImage</h1>
+<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</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.fillStyle = 'skyblue';
+ ctx.fillRect(0, 0, 100, 100);
+
+ ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10,
+ stdDeviation: 0, floodColor: 'navy'}});
+
+ ctx.fillStyle = 'maroon';
+ ctx.fillRect(20, 20, 50, 50);
+
+ ctx.globalCompositeOperation = 'xor';
+
+ // The image should xor only with the layer content, not the parents'.
+ const canvas_image = new OffscreenCanvas(200,200);
+ const ctx_image = canvas_image.getContext("2d");
+ ctx_image.fillStyle = 'pink';
+ ctx_image.fillRect(40, 40, 50, 50);
+ ctx.drawImage(canvas_image, 0, 0);
+
+ ctx.endLayer();
+
+ 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>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html
index be6f962b33..0e48cb49f7 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html">
+<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-2453">
<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title>
<h1>2d.layer.global-states.filter.alpha.blending</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html
index 2b53ad7c1e..3887ed4485 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html
@@ -2,6 +2,7 @@
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
<link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html">
+<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-2453">
<title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title>
<h1>2d.layer.global-states.filter.alpha.blending</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html
index 087fea88af..1a9bc8b733 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html">
+<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-5204">
<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title>
<h1>2d.layer.global-states.filter.alpha.composite</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html
index 6aa83a3278..5c90fe95aa 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html
@@ -2,6 +2,7 @@
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
<link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html">
+<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-5204">
<title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title>
<h1>2d.layer.global-states.filter.alpha.composite</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html
index f1d631c25c..f64e8925f0 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<link rel="match" href="2d.layer.global-states.filter.alpha-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6766">
<title>Canvas test: 2d.layer.global-states.filter.alpha</title>
<h1>2d.layer.global-states.filter.alpha</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html
index 2548c21181..5e8911ee17 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6311">
<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title>
<h1>2d.layer.global-states.filter.alpha.shadow</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html
index 5e1494422e..b3be7e1ac8 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html
@@ -2,6 +2,7 @@
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
<link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6311">
<title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title>
<h1>2d.layer.global-states.filter.alpha.shadow</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html
index e75d668ad5..21e55f856c 100644
--- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html
+++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html
@@ -2,6 +2,7 @@
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<html class="reftest-wait">
<link rel="match" href="2d.layer.global-states.filter.alpha-expected.html">
+<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6766">
<title>Canvas test: 2d.layer.global-states.filter.alpha</title>
<h1>2d.layer.global-states.filter.alpha</h1>
<p class="desc">Checks that layers with filters correctly use global render states.</p>