diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html index d64b81026ad5f60..77818444c87c903 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html @@ -19,12 +19,12 @@

2d.filter.canvasFilterObject.blur.exceptions.tentative

var t = async_test("Test exceptions on CanvasFilter() blur.object"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); }); diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html index 678a722520a98bb..a56840e60739638 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html @@ -19,44 +19,44 @@

2d.filter.canvasFilterObject.colorMatrix.tentative

var t = async_test("Test the functionality of ColorMatrix filters in CanvasFilter objects"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: "foo"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "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({filter: "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({filter: "colorMatrix", type: "hueRotate", values: 0}); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: '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({filter: '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({filter: 'colorMatrix', type: 'hueRotate', values: 0}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); +ctx.filter = new CanvasFilter({filter: '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({filter: "colorMatrix", type: "luminanceToAlpha"}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ +ctx.filter = new CanvasFilter({filter: '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.fillStyle = '#0f0'; ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = "#00f"; +ctx.fillStyle = '#00f'; ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = "#fff"; +ctx.fillStyle = '#fff'; ctx.fillRect(50, 25, 50, 25); _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html index 0ecd132c8efa286..c54299ff2a5a45f 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html @@ -40,10 +40,10 @@

2d.filter.canvasFilterObject.componentTransfer.discrete.tentative

tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "discrete", tableValues: tableValuesR}, - funcG: {type: "discrete", tableValues: tableValuesG}, - funcB: {type: "discrete", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html index 4ef30c9249bb01f..110cd2396ea893d 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html @@ -31,10 +31,10 @@

2d.filter.canvasFilterObject.componentTransfer.gamma.tentative

const amplitudes = [2, 1.1, 0.5]; const exponents = [5, 3, 1]; const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html index 25eda36d96b0877..96a3e4936ee2640 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html @@ -19,10 +19,10 @@

2d.filter.canvasFilterObject.componentTransfer.identity.tentative

var t = async_test("Test pixels on CanvasFilter() componentTransfer with identity type"); _addTest(function(canvas, ctx) { -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "identity"}, - funcG: {type: "identity"}, - funcB: {type: "identity"}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, }); const inputColors = [ diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html index c45f5586009150b..10f9931cc6430ef 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html @@ -30,10 +30,10 @@

2d.filter.canvasFilterObject.componentTransfer.linear.tentative

const slopes = [0.5, 1.2, -0.2]; const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html index b561cb6fd3f0a8d..7e743bf34f008d0 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html @@ -40,10 +40,10 @@

2d.filter.canvasFilterObject.componentTransfer.table.tentative

tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "table", tableValues: tableValuesR}, - funcG: {type: "table", tableValues: tableValuesG}, - funcB: {type: "table", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html index b85b742b3ebb2c2..b994a91842c031f 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html @@ -19,23 +19,23 @@

2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative

var t = async_test("Test exceptions on CanvasFilter() convolveMatrix"); _addTest(function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], [1, 2]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); // This should not throw an error -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); }); diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html index 90f406fed9fd854..62226d7d81fbf43 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html @@ -22,52 +22,52 @@

2d.filter.canvasFilterObject.dropShadow.tentative

-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html index 22c6a6547f23650..712716d9f01e838 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html @@ -19,64 +19,64 @@

2d.filter.canvasFilterObject.dropShadow.tentative

ctx.fillStyle = 'crimson'; // Parameter defaults. - ctx.filter = new CanvasFilter({filter: "dropShadow"}); + ctx.filter = new CanvasFilter({filter: 'dropShadow'}); ctx.fillRect(10, 10, 80, 80); // All parameters specified. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 5, - floodColor: "purple", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 5, + floodColor: 'purple', floodOpacity: 0.7}); ctx.fillRect(110, 10, 80, 80); // Named color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 10, stdDeviation: 3, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 10, stdDeviation: 3, + floodColor: 'purple'}); ctx.fillRect(10, 110, 80, 80); // System color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "LinkText"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'LinkText'}); ctx.fillRect(110, 110, 80, 80); // No blur. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 15, stdDeviation: 0, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 15, stdDeviation: 0, + floodColor: 'purple'}); ctx.fillRect(210, 110, 80, 80); // Numerical color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 9, dy: 12, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 1)"}); + {filter: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 1)'}); ctx.fillRect(310, 110, 80, 80); // Transparent floodColor. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)'}); ctx.fillRect(410, 110, 80, 80); // Transparent floodColor and floodOpacity. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}); ctx.fillRect(510, 110, 80, 80); // Degenerate parameter values. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: [-5], dy: [], stdDeviation: null, - floodColor: "purple", floodOpacity: [2]}); + {filter: 'dropShadow', dx: [-5], dy: [], stdDeviation: null, + floodColor: 'purple', floodOpacity: [2]}); ctx.fillRect(10, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: null, dy: '5', stdDeviation: -5, - floodColor: "purple", floodOpacity: '0.8'}); + {filter: 'dropShadow', dx: null, dy: '5', stdDeviation: -5, + floodColor: 'purple', floodOpacity: '0.8'}); ctx.fillRect(110, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: true, dy: ['10'], stdDeviation: false, - floodColor: "purple", floodOpacity: ['0.4']}); + {filter: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false, + floodColor: 'purple', floodOpacity: ['0.4']}); ctx.fillRect(210, 210, 80, 80); diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html index 3a32eb6a55a2487..a4625db01977fe2 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative.html @@ -22,11 +22,11 @@

2d.filter.canvasFilterObject.tentative

_assert(ctx.filter == 'none', "ctx.filter == 'none'"); ctx.filter = 'blur(5px)'; _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); ctx.filter = new CanvasFilter([ - {filter: "gaussianBlur", stdDeviation: 5}, - {filter: "gaussianBlur", stdDeviation: 10} + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} ]); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); var canvas2 = document.createElement('canvas'); @@ -37,8 +37,8 @@

2d.filter.canvasFilterObject.tentative

_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); ctx.filter = 'none'; _assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); -ctx.filter = "this string is not a filter and should do nothing"; +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); +ctx.filter = 'this string is not a filter and should do nothing'; _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); diff --git a/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html index 1f9d978ac8c29f8..64f909a7fdb25ee 100644 --- a/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html +++ b/html/canvas/element/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html @@ -27,7 +27,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{baseFrequency: Infinity}, {baseFrequency: undefined}, {baseFrequency: -Infinity}, - {baseFrequency: "test"}, + {baseFrequency: 'test'}, {numOctaves: {}}, {numOctaves: -1}, @@ -36,7 +36,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{numOctaves: undefined}, {numOctaves: -Infinity}, {numOctaves: [1, 1]}, - {numOctaves: "test"}, + {numOctaves: 'test'}, {seed: {}}, {seed: NaN}, @@ -44,7 +44,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{seed: undefined}, {seed: -Infinity}, {seed: [1, 1]}, - {seed: "test"}, + {seed: 'test'}, {stitchTiles: {}}, {stitchTiles: NaN}, @@ -52,14 +52,14 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{stitchTiles: undefined}, {stitchTiles: -Infinity}, {stitchTiles: [1, 1]}, - {stitchTiles: "test"}, + {stitchTiles: 'test'}, {stitchTiles: null}, {stitchTiles: []}, {stitchTiles: [10]}, {stitchTiles: 30}, {stitchTiles: false}, {stitchTiles: true}, - {stitchTiles: "10"}, + {stitchTiles: '10'}, {stitchTiles: -1}, {type: {}}, @@ -68,14 +68,14 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{type: undefined}, {type: -Infinity}, {type: [1, 1]}, - {type: "test"}, + {type: 'test'}, {type: null}, {type: []}, {type: [10]}, {type: 30}, {type: false}, {type: true}, - {type: "10"}, + {type: '10'}, {type: -1}, ] @@ -88,7 +88,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{baseFrequency: 30}, {baseFrequency: false}, {baseFrequency: true}, - {baseFrequency: "10"}, + {baseFrequency: '10'}, {numOctaves: null}, {numOctaves: []}, @@ -96,7 +96,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{numOctaves: 30}, {numOctaves: false}, {numOctaves: true}, - {numOctaves: "10"}, + {numOctaves: '10'}, {seed: null}, {seed: []}, @@ -104,23 +104,23 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{seed: 30}, {seed: false}, {seed: true}, - {seed: "10"}, + {seed: '10'}, {seed: -1}, - {stitchTiles: "stitch"}, - {stitchTiles: "noStitch"}, + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, - {type: "fractalNoise"}, - {type: "turbulence"}, + {type: 'fractalNoise'}, + {type: 'turbulence'}, ] for (testCase of errorTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); } for (testCase of workingTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); } diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html index 6ce6fb633f8c08e..f5332780c82b41d 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.html @@ -21,12 +21,12 @@

2d.filter.canvasFilterObject.blur.exceptions.tentative

var ctx = canvas.getContext('2d'); await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); })(canvas, ctx); t.done(); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js index a44868f585c67cc..61f10308801caa7 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.blur.exceptions.tentative.worker.js @@ -16,12 +16,12 @@ t.step(function() { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); }); -assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); }); +assert_throws_js(TypeError, function() { ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); }); t.done(); }); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html index 3eda41776c0ef28..f3dd3037bb7ab7b 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.html @@ -21,44 +21,44 @@

2d.filter.canvasFilterObject.colorMatrix.tentative

var ctx = canvas.getContext('2d'); await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: "foo"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "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({filter: "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({filter: "colorMatrix", type: "hueRotate", values: 0}); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: '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({filter: '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({filter: 'colorMatrix', type: 'hueRotate', values: 0}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); +ctx.filter = new CanvasFilter({filter: '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({filter: "colorMatrix", type: "luminanceToAlpha"}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ +ctx.filter = new CanvasFilter({filter: '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.fillStyle = '#0f0'; ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = "#00f"; +ctx.fillStyle = '#00f'; ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = "#fff"; +ctx.fillStyle = '#fff'; ctx.fillRect(50, 25, 50, 25); _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js index 105f312b9ceae02..19d57b61e53242a 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.colorMatrix.tentative.worker.js @@ -16,44 +16,44 @@ t.step(function() { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: undefined}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: "foo"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "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({filter: "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({filter: "colorMatrix", type: "hueRotate", values: 0}); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: undefined}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: '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({filter: '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({filter: 'colorMatrix', type: 'hueRotate', values: 0}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 255,0,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,91,0,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,109,109,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 109,18,255,255, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); +ctx.filter = new CanvasFilter({filter: '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({filter: "colorMatrix", type: "luminanceToAlpha"}); +ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 10,10, 0,0,0,54, 2); -ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ +ctx.filter = new CanvasFilter({filter: '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.fillStyle = '#0f0'; ctx.fillRect(50, 0, 50, 25); -ctx.fillStyle = "#00f"; +ctx.fillStyle = '#00f'; ctx.fillRect(0, 25, 50, 25); -ctx.fillStyle = "#fff"; +ctx.fillStyle = '#fff'; ctx.fillRect(50, 25, 50, 25); _assertPixelApprox(canvas, 10,10, 0,255,0,255, 2); _assertPixelApprox(canvas, 60,10, 0,255,0,255, 2); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html index 7cb8b0dd143602b..dd6fc9ee5ff1694 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.html @@ -42,10 +42,10 @@

2d.filter.canvasFilterObject.componentTransfer.discrete.tentative

tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "discrete", tableValues: tableValuesR}, - funcG: {type: "discrete", tableValues: tableValuesG}, - funcB: {type: "discrete", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js index f1274f14253c559..79a5cd2475ca911 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.discrete.tentative.worker.js @@ -37,10 +37,10 @@ function getColor(inputColor, tableValues) { tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "discrete", tableValues: tableValuesR}, - funcG: {type: "discrete", tableValues: tableValuesG}, - funcB: {type: "discrete", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html index 388fdca6f9d8db4..f2a9fcfd49a4a66 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.html @@ -33,10 +33,10 @@

2d.filter.canvasFilterObject.componentTransfer.gamma.tentative

const amplitudes = [2, 1.1, 0.5]; const exponents = [5, 3, 1]; const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js index 14bf50f89dde725..a36fa19a5efad69 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.gamma.tentative.worker.js @@ -28,10 +28,10 @@ function getColor(inputColor, amplitude, exponent, offset) { const amplitudes = [2, 1.1, 0.5]; const exponents = [5, 3, 1]; const offsets = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html index 44eb7184956bd4b..33aae01eb056f9c 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.html @@ -21,10 +21,10 @@

2d.filter.canvasFilterObject.componentTransfer.identity.tentative

var ctx = canvas.getContext('2d'); await (function(canvas, ctx) { -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "identity"}, - funcG: {type: "identity"}, - funcB: {type: "identity"}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js index ae749673f4362ea..7236c7087a17437 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.identity.tentative.worker.js @@ -16,10 +16,10 @@ t.step(function() { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "identity"}, - funcG: {type: "identity"}, - funcB: {type: "identity"}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html index d24a9e8608d1b2c..23731a1286ce723 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.html @@ -32,10 +32,10 @@

2d.filter.canvasFilterObject.componentTransfer.linear.tentative

const slopes = [0.5, 1.2, -0.2]; const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js index 5117d4a1b3b0d68..9a4499d4d6b7011 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.linear.tentative.worker.js @@ -27,10 +27,10 @@ function getColor(inputColor, slopes, intercepts) { const slopes = [0.5, 1.2, -0.2]; const intercepts = [0.25, 0, 0.5]; -ctx.filter = new CanvasFilter({filter: "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]}, +ctx.filter = new CanvasFilter({filter: '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 = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html index a704557cc54551a..c11e6adb9109972 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.html @@ -42,10 +42,10 @@

2d.filter.canvasFilterObject.componentTransfer.table.tentative

tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "table", tableValues: tableValuesR}, - funcG: {type: "table", tableValues: tableValuesG}, - funcB: {type: "table", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js index e2463eb9e7663b0..8ff791d3bb98673 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.componentTransfer.table.tentative.worker.js @@ -37,10 +37,10 @@ function getColor(inputColor, tableValues) { tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; -ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "table", tableValues: tableValuesR}, - funcG: {type: "table", tableValues: tableValuesG}, - funcB: {type: "table", tableValues: tableValuesB}, +ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, }); const inputColors = [ diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html index 0a6bddc56d7b339..c4b6df8e0db0bec 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.html @@ -21,23 +21,23 @@

2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative

var ctx = canvas.getContext('2d'); await (function(canvas, ctx) { -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], [1, 2]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); // This should not throw an error -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); })(canvas, ctx); t.done(); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js index bce4c0be158aafc..f7e616e7a63fc32 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative.worker.js @@ -16,23 +16,23 @@ t.step(function() { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix"}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", divisor: 2}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1, 2, 3, 4]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 2], []]}); }); -assert_throws_js(TypeError, function() { new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], [1, 2]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix'}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); }); +assert_throws_js(TypeError, function() { new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); }); // This should not throw an error -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); -ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); +ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); t.done(); }); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html index 90f406fed9fd854..62226d7d81fbf43 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative-expected.html @@ -22,52 +22,52 @@

2d.filter.canvasFilterObject.dropShadow.tentative

-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html index 04cf86d204ce8e1..043265279054d6d 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.html @@ -19,65 +19,65 @@

2d.filter.canvasFilterObject.dropShadow.tentative

ctx.fillStyle = 'crimson'; // Parameter defaults. - ctx.filter = new CanvasFilter({filter: "dropShadow"}); + ctx.filter = new CanvasFilter({filter: 'dropShadow'}); ctx.fillRect(10, 10, 80, 80); // All parameters specified. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 5, - floodColor: "purple", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 5, + floodColor: 'purple', floodOpacity: 0.7}); ctx.fillRect(110, 10, 80, 80); // Named color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 10, stdDeviation: 3, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 10, stdDeviation: 3, + floodColor: 'purple'}); ctx.fillRect(10, 110, 80, 80); // System color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "LinkText"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'LinkText'}); ctx.fillRect(110, 110, 80, 80); // No blur. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 15, stdDeviation: 0, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 15, stdDeviation: 0, + floodColor: 'purple'}); ctx.fillRect(210, 110, 80, 80); // Numerical color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 9, dy: 12, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 1)"}); + {filter: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 1)'}); ctx.fillRect(310, 110, 80, 80); // Transparent floodColor. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)'}); ctx.fillRect(410, 110, 80, 80); // Transparent floodColor and floodOpacity. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}); ctx.fillRect(510, 110, 80, 80); // Degenerate parameter values. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: [-5], dy: [], stdDeviation: null, - floodColor: "purple", floodOpacity: [2]}); + {filter: 'dropShadow', dx: [-5], dy: [], stdDeviation: null, + floodColor: 'purple', floodOpacity: [2]}); ctx.fillRect(10, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: null, dy: '5', stdDeviation: -5, - floodColor: "purple", floodOpacity: '0.8'}); + {filter: 'dropShadow', dx: null, dy: '5', stdDeviation: -5, + floodColor: 'purple', floodOpacity: '0.8'}); ctx.fillRect(110, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: true, dy: ['10'], stdDeviation: false, - floodColor: "purple", floodOpacity: ['0.4']}); + {filter: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false, + floodColor: 'purple', floodOpacity: ['0.4']}); ctx.fillRect(210, 210, 80, 80); const canvas = document.getElementById("canvas"); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html index 8d5e2da1586a569..de72f5fe3d9fa07 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.tentative.w.html @@ -21,65 +21,65 @@

2d.filter.canvasFilterObject.dropShadow.tentative

ctx.fillStyle = 'crimson'; // Parameter defaults. - ctx.filter = new CanvasFilter({filter: "dropShadow"}); + ctx.filter = new CanvasFilter({filter: 'dropShadow'}); ctx.fillRect(10, 10, 80, 80); // All parameters specified. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 5, - floodColor: "purple", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 5, + floodColor: 'purple', floodOpacity: 0.7}); ctx.fillRect(110, 10, 80, 80); // Named color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 10, stdDeviation: 3, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 10, stdDeviation: 3, + floodColor: 'purple'}); ctx.fillRect(10, 110, 80, 80); // System color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "LinkText"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'LinkText'}); ctx.fillRect(110, 110, 80, 80); // No blur. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 15, stdDeviation: 0, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 15, stdDeviation: 0, + floodColor: 'purple'}); ctx.fillRect(210, 110, 80, 80); // Numerical color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 9, dy: 12, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 1)"}); + {filter: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 1)'}); ctx.fillRect(310, 110, 80, 80); // Transparent floodColor. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)'}); ctx.fillRect(410, 110, 80, 80); // Transparent floodColor and floodOpacity. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}); ctx.fillRect(510, 110, 80, 80); // Degenerate parameter values. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: [-5], dy: [], stdDeviation: null, - floodColor: "purple", floodOpacity: [2]}); + {filter: 'dropShadow', dx: [-5], dy: [], stdDeviation: null, + floodColor: 'purple', floodOpacity: [2]}); ctx.fillRect(10, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: null, dy: '5', stdDeviation: -5, - floodColor: "purple", floodOpacity: '0.8'}); + {filter: 'dropShadow', dx: null, dy: '5', stdDeviation: -5, + floodColor: 'purple', floodOpacity: '0.8'}); ctx.fillRect(110, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: true, dy: ['10'], stdDeviation: false, - floodColor: "purple", floodOpacity: ['0.4']}); + {filter: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false, + floodColor: 'purple', floodOpacity: ['0.4']}); ctx.fillRect(210, 210, 80, 80); const bitmap = oc.transferToImageBitmap(); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html index 75d369cad2f9e0c..4d80dddf0071467 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.html @@ -24,11 +24,11 @@

2d.filter.canvasFilterObject.tentative

_assert(ctx.filter == 'none', "ctx.filter == 'none'"); ctx.filter = 'blur(5px)'; _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); ctx.filter = new CanvasFilter([ - {filter: "gaussianBlur", stdDeviation: 5}, - {filter: "gaussianBlur", stdDeviation: 10} + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} ]); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); var canvas2 = new OffscreenCanvas(100, 50); @@ -39,8 +39,8 @@

2d.filter.canvasFilterObject.tentative

_assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); ctx.filter = 'none'; _assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); -ctx.filter = "this string is not a filter and should do nothing"; +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); +ctx.filter = 'this string is not a filter and should do nothing'; _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); })(canvas, ctx); t.done(); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js index 30772a39d102169..48c4a0448d95e59 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker.js @@ -19,11 +19,11 @@ var ctx = canvas.getContext('2d'); _assert(ctx.filter == 'none', "ctx.filter == 'none'"); ctx.filter = 'blur(5px)'; _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); ctx.filter = new CanvasFilter([ - {filter: "gaussianBlur", stdDeviation: 5}, - {filter: "gaussianBlur", stdDeviation: 10} + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} ]); _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); var canvas2 = new OffscreenCanvas(100, 50); @@ -34,8 +34,8 @@ ctx.filter = 'blur(5px)'; _assert(ctx.filter == 'blur(5px)', "ctx.filter == 'blur(5px)'"); ctx.filter = 'none'; _assert(ctx.filter == 'none', "ctx.filter == 'none'"); -ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); -ctx.filter = "this string is not a filter and should do nothing"; +ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); +ctx.filter = 'this string is not a filter and should do nothing'; _assert(ctx.filter.toString() == '[object CanvasFilter]', "ctx.filter.toString() == '[object CanvasFilter]'"); t.done(); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html index 610dca9feaf59af..2ed61e66d0335be 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.html @@ -29,7 +29,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{baseFrequency: Infinity}, {baseFrequency: undefined}, {baseFrequency: -Infinity}, - {baseFrequency: "test"}, + {baseFrequency: 'test'}, {numOctaves: {}}, {numOctaves: -1}, @@ -38,7 +38,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{numOctaves: undefined}, {numOctaves: -Infinity}, {numOctaves: [1, 1]}, - {numOctaves: "test"}, + {numOctaves: 'test'}, {seed: {}}, {seed: NaN}, @@ -46,7 +46,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{seed: undefined}, {seed: -Infinity}, {seed: [1, 1]}, - {seed: "test"}, + {seed: 'test'}, {stitchTiles: {}}, {stitchTiles: NaN}, @@ -54,14 +54,14 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{stitchTiles: undefined}, {stitchTiles: -Infinity}, {stitchTiles: [1, 1]}, - {stitchTiles: "test"}, + {stitchTiles: 'test'}, {stitchTiles: null}, {stitchTiles: []}, {stitchTiles: [10]}, {stitchTiles: 30}, {stitchTiles: false}, {stitchTiles: true}, - {stitchTiles: "10"}, + {stitchTiles: '10'}, {stitchTiles: -1}, {type: {}}, @@ -70,14 +70,14 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{type: undefined}, {type: -Infinity}, {type: [1, 1]}, - {type: "test"}, + {type: 'test'}, {type: null}, {type: []}, {type: [10]}, {type: 30}, {type: false}, {type: true}, - {type: "10"}, + {type: '10'}, {type: -1}, ] @@ -90,7 +90,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{baseFrequency: 30}, {baseFrequency: false}, {baseFrequency: true}, - {baseFrequency: "10"}, + {baseFrequency: '10'}, {numOctaves: null}, {numOctaves: []}, @@ -98,7 +98,7 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{numOctaves: 30}, {numOctaves: false}, {numOctaves: true}, - {numOctaves: "10"}, + {numOctaves: '10'}, {seed: null}, {seed: []}, @@ -106,23 +106,23 @@

2d.filter.canvasFilterObject.turbulence.inputTypes.tentative

{seed: 30}, {seed: false}, {seed: true}, - {seed: "10"}, + {seed: '10'}, {seed: -1}, - {stitchTiles: "stitch"}, - {stitchTiles: "noStitch"}, + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, - {type: "fractalNoise"}, - {type: "turbulence"}, + {type: 'fractalNoise'}, + {type: 'turbulence'}, ] for (testCase of errorTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); } for (testCase of workingTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); } })(canvas, ctx); diff --git a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js index 76673fab9a7e6a1..1bed65ad156a781 100644 --- a/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js +++ b/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.turbulence.inputTypes.tentative.worker.js @@ -24,7 +24,7 @@ const errorTestCases = [ {baseFrequency: Infinity}, {baseFrequency: undefined}, {baseFrequency: -Infinity}, - {baseFrequency: "test"}, + {baseFrequency: 'test'}, {numOctaves: {}}, {numOctaves: -1}, @@ -33,7 +33,7 @@ const errorTestCases = [ {numOctaves: undefined}, {numOctaves: -Infinity}, {numOctaves: [1, 1]}, - {numOctaves: "test"}, + {numOctaves: 'test'}, {seed: {}}, {seed: NaN}, @@ -41,7 +41,7 @@ const errorTestCases = [ {seed: undefined}, {seed: -Infinity}, {seed: [1, 1]}, - {seed: "test"}, + {seed: 'test'}, {stitchTiles: {}}, {stitchTiles: NaN}, @@ -49,14 +49,14 @@ const errorTestCases = [ {stitchTiles: undefined}, {stitchTiles: -Infinity}, {stitchTiles: [1, 1]}, - {stitchTiles: "test"}, + {stitchTiles: 'test'}, {stitchTiles: null}, {stitchTiles: []}, {stitchTiles: [10]}, {stitchTiles: 30}, {stitchTiles: false}, {stitchTiles: true}, - {stitchTiles: "10"}, + {stitchTiles: '10'}, {stitchTiles: -1}, {type: {}}, @@ -65,14 +65,14 @@ const errorTestCases = [ {type: undefined}, {type: -Infinity}, {type: [1, 1]}, - {type: "test"}, + {type: 'test'}, {type: null}, {type: []}, {type: [10]}, {type: 30}, {type: false}, {type: true}, - {type: "10"}, + {type: '10'}, {type: -1}, ] @@ -85,7 +85,7 @@ const workingTestCases = [ {baseFrequency: 30}, {baseFrequency: false}, {baseFrequency: true}, - {baseFrequency: "10"}, + {baseFrequency: '10'}, {numOctaves: null}, {numOctaves: []}, @@ -93,7 +93,7 @@ const workingTestCases = [ {numOctaves: 30}, {numOctaves: false}, {numOctaves: true}, - {numOctaves: "10"}, + {numOctaves: '10'}, {seed: null}, {seed: []}, @@ -101,23 +101,23 @@ const workingTestCases = [ {seed: 30}, {seed: false}, {seed: true}, - {seed: "10"}, + {seed: '10'}, {seed: -1}, - {stitchTiles: "stitch"}, - {stitchTiles: "noStitch"}, + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, - {type: "fractalNoise"}, - {type: "turbulence"}, + {type: 'fractalNoise'}, + {type: 'turbulence'}, ] for (testCase of errorTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; assert_throws_js(TypeError, function() { new CanvasFilter(filterOptions); }); } for (testCase of workingTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; _assert(new CanvasFilter(filterOptions) != null, "new CanvasFilter(filterOptions) != null"); } t.done(); diff --git a/html/canvas/tools/yaml-new/filters.yaml b/html/canvas/tools/yaml-new/filters.yaml index bdf3dcfe9fc47be..46171c130256f2e 100644 --- a/html/canvas/tools/yaml-new/filters.yaml +++ b/html/canvas/tools/yaml-new/filters.yaml @@ -40,11 +40,11 @@ @assert ctx.filter == 'none'; ctx.filter = 'blur(5px)'; @assert ctx.filter == 'blur(5px)'; - ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); @assert ctx.filter.toString() == '[object CanvasFilter]'; ctx.filter = new CanvasFilter([ - {filter: "gaussianBlur", stdDeviation: 5}, - {filter: "gaussianBlur", stdDeviation: 10} + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} ]); @assert ctx.filter.toString() == '[object CanvasFilter]'; var canvas2 = document.createElement('canvas'); @@ -55,8 +55,8 @@ @assert ctx.filter == 'blur(5px)'; ctx.filter = 'none'; @assert ctx.filter == 'none'; - ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); - ctx.filter = "this string is not a filter and should do nothing"; + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + ctx.filter = 'this string is not a filter and should do nothing'; @assert ctx.filter.toString() == '[object CanvasFilter]'; - name: 2d.filter.canvasFilterObject.tentative @@ -66,11 +66,11 @@ @assert ctx.filter == 'none'; ctx.filter = 'blur(5px)'; @assert ctx.filter == 'blur(5px)'; - ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); @assert ctx.filter.toString() == '[object CanvasFilter]'; ctx.filter = new CanvasFilter([ - {filter: "gaussianBlur", stdDeviation: 5}, - {filter: "gaussianBlur", stdDeviation: 10} + {filter: 'gaussianBlur', stdDeviation: 5}, + {filter: 'gaussianBlur', stdDeviation: 10} ]); @assert ctx.filter.toString() == '[object CanvasFilter]'; var canvas2 = new OffscreenCanvas(100, 50); @@ -81,61 +81,61 @@ @assert ctx.filter == 'blur(5px)'; ctx.filter = 'none'; @assert ctx.filter == 'none'; - ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: 5}); - ctx.filter = "this string is not a filter and should do nothing"; + ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 5}); + ctx.filter = 'this string is not a filter and should do nothing'; @assert ctx.filter.toString() == '[object CanvasFilter]'; - name: 2d.filter.canvasFilterObject.blur.exceptions.tentative desc: Test exceptions on CanvasFilter() blur.object code: | - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur"}); - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: undefined}); - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: "foo"}); - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: [1,2]}); - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: NaN}); - @assert throws TypeError ctx.filter = new CanvasFilter({filter: "gaussianBlur", stdDeviation: {}}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur'}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: undefined}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: 'foo'}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: [1,2]}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: NaN}); + @assert throws TypeError ctx.filter = new CanvasFilter({filter: 'gaussianBlur', stdDeviation: {}}); - name: 2d.filter.canvasFilterObject.colorMatrix.tentative desc: Test the functionality of ColorMatrix filters in CanvasFilter objects code: | - @assert throws TypeError new CanvasFilter({filter: "colorMatrix", values: undefined}); - @assert throws TypeError new CanvasFilter({filter: "colorMatrix", values: "foo"}); - @assert throws TypeError new CanvasFilter({filter: "colorMatrix", values: null}); - @assert throws TypeError new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3]}); - @assert throws TypeError new CanvasFilter({filter: "colorMatrix", values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, "a"]}); - @assert throws TypeError new CanvasFilter({filter: "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({filter: "colorMatrix", type: "hueRotate", values: 0}); + @assert throws TypeError new CanvasFilter({filter: 'colorMatrix', values: undefined}); + @assert throws TypeError new CanvasFilter({filter: 'colorMatrix', values: 'foo'}); + @assert throws TypeError new CanvasFilter({filter: 'colorMatrix', values: null}); + @assert throws TypeError new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3]}); + @assert throws TypeError new CanvasFilter({filter: 'colorMatrix', values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 'a']}); + @assert throws TypeError new CanvasFilter({filter: '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({filter: 'colorMatrix', type: 'hueRotate', values: 0}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 255,0,0,255; - ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 90}); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 90}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 0,91,0,255; - ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 180}); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 180}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 0,109,109,255; - ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "hueRotate", values: 270}); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'hueRotate', values: 270}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 109,18,255,255; - ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "saturate", values: 0.5}); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'saturate', values: 0.5}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 155,27,27,255; ctx.clearRect(0, 0, 100, 50); - ctx.filter = new CanvasFilter({filter: "colorMatrix", type: "luminanceToAlpha"}); + ctx.filter = new CanvasFilter({filter: 'colorMatrix', type: 'luminanceToAlpha'}); ctx.fillRect(0, 0, 100, 50); @assert pixel 10,10 ==~ 0,0,0,54; - ctx.filter = new CanvasFilter({filter: "colorMatrix", values: [ + ctx.filter = new CanvasFilter({filter: '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.fillStyle = '#0f0'; ctx.fillRect(50, 0, 50, 25); - ctx.fillStyle = "#00f"; + ctx.fillStyle = '#00f'; ctx.fillRect(0, 25, 50, 25); - ctx.fillStyle = "#fff"; + ctx.fillStyle = '#fff'; ctx.fillRect(50, 25, 50, 25); @assert pixel 10,10 ==~ 0,255,0,255; @assert pixel 60,10 ==~ 0,255,0,255; @@ -145,23 +145,23 @@ - name: 2d.filter.canvasFilterObject.convolveMatrix.exceptions.tentative desc: Test exceptions on CanvasFilter() convolveMatrix code: | - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix"}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", divisor: 2}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: null}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: 1}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0]]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, "a"], [0]]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], 0]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 0], [0, Infinity]]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: []}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [1, 2, 3, 4]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], []]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1, 2], []]}); - @assert throws TypeError new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[], [1, 2]]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix'}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', divisor: 2}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: null}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: 1}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0]]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 'a'], [0]]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], 0]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 0], [0, Infinity]]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: []}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [1, 2, 3, 4]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], []]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1, 2], []]}); + @assert throws TypeError new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[], [1, 2]]}); // This should not throw an error - ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[]]}); - ctx.filter = new CanvasFilter({filter: "convolveMatrix", kernelMatrix: [[1]]}); + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[]]}); + ctx.filter = new CanvasFilter({filter: 'convolveMatrix', kernelMatrix: [[1]]}); - name: 2d.filter.canvasFilterObject.componentTransfer.linear.tentative desc: Test pixels on CanvasFilter() componentTransfer with linear type @@ -177,10 +177,10 @@ const slopes = [0.5, 1.2, -0.2]; const intercepts = [0.25, 0, 0.5]; - ctx.filter = new CanvasFilter({filter: "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]}, + ctx.filter = new CanvasFilter({filter: '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 = [ @@ -201,10 +201,10 @@ - name: 2d.filter.canvasFilterObject.componentTransfer.identity.tentative desc: Test pixels on CanvasFilter() componentTransfer with identity type code: | - ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "identity"}, - funcG: {type: "identity"}, - funcB: {type: "identity"}, + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'identity'}, + funcG: {type: 'identity'}, + funcB: {type: 'identity'}, }); const inputColors = [ @@ -236,10 +236,10 @@ const amplitudes = [2, 1.1, 0.5]; const exponents = [5, 3, 1]; const offsets = [0.25, 0, 0.5]; - ctx.filter = new CanvasFilter({filter: "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]}, + ctx.filter = new CanvasFilter({filter: '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 = [ @@ -281,10 +281,10 @@ tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; - ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "table", tableValues: tableValuesR}, - funcG: {type: "table", tableValues: tableValuesG}, - funcB: {type: "table", tableValues: tableValuesB}, + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'table', tableValues: tableValuesR}, + funcG: {type: 'table', tableValues: tableValuesG}, + funcB: {type: 'table', tableValues: tableValuesB}, }); const inputColors = [ @@ -326,10 +326,10 @@ tableValuesR = [0, 0, 1, 1]; tableValuesG = [2, 0, 0.5, 3]; tableValuesB = [1, -1, 5, 0]; - ctx.filter = new CanvasFilter({filter: "componentTransfer", - funcR: {type: "discrete", tableValues: tableValuesR}, - funcG: {type: "discrete", tableValues: tableValuesG}, - funcB: {type: "discrete", tableValues: tableValuesB}, + ctx.filter = new CanvasFilter({filter: 'componentTransfer', + funcR: {type: 'discrete', tableValues: tableValuesR}, + funcG: {type: 'discrete', tableValues: tableValuesG}, + funcB: {type: 'discrete', tableValues: tableValuesB}, }); const inputColors = [ @@ -359,65 +359,65 @@ ctx.fillStyle = 'crimson'; // Parameter defaults. - ctx.filter = new CanvasFilter({filter: "dropShadow"}); + ctx.filter = new CanvasFilter({filter: 'dropShadow'}); ctx.fillRect(10, 10, 80, 80); // All parameters specified. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 5, - floodColor: "purple", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 5, + floodColor: 'purple', floodOpacity: 0.7}); ctx.fillRect(110, 10, 80, 80); // Named color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 10, stdDeviation: 3, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 10, stdDeviation: 3, + floodColor: 'purple'}); ctx.fillRect(10, 110, 80, 80); // System color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "LinkText"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'LinkText'}); ctx.fillRect(110, 110, 80, 80); // No blur. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 10, dy: 15, stdDeviation: 0, - floodColor: "purple"}); + {filter: 'dropShadow', dx: 10, dy: 15, stdDeviation: 0, + floodColor: 'purple'}); ctx.fillRect(210, 110, 80, 80); // Numerical color. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 9, dy: 12, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 1)"}); + {filter: 'dropShadow', dx: 9, dy: 12, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 1)'}); ctx.fillRect(310, 110, 80, 80); // Transparent floodColor. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)"}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)'}); ctx.fillRect(410, 110, 80, 80); // Transparent floodColor and floodOpacity. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: 15, dy: 10, stdDeviation: 3, - floodColor: "rgba(20, 50, 130, 0.7)", floodOpacity: 0.7}); + {filter: 'dropShadow', dx: 15, dy: 10, stdDeviation: 3, + floodColor: 'rgba(20, 50, 130, 0.7)', floodOpacity: 0.7}); ctx.fillRect(510, 110, 80, 80); // Degenerate parameter values. ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: [-5], dy: [], stdDeviation: null, - floodColor: "purple", floodOpacity: [2]}); + {filter: 'dropShadow', dx: [-5], dy: [], stdDeviation: null, + floodColor: 'purple', floodOpacity: [2]}); ctx.fillRect(10, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: null, dy: '5', stdDeviation: -5, - floodColor: "purple", floodOpacity: '0.8'}); + {filter: 'dropShadow', dx: null, dy: '5', stdDeviation: -5, + floodColor: 'purple', floodOpacity: '0.8'}); ctx.fillRect(110, 210, 80, 80); ctx.filter = new CanvasFilter( - {filter: "dropShadow", dx: true, dy: ['10'], stdDeviation: false, - floodColor: "purple", floodOpacity: ['0.4']}); + {filter: 'dropShadow', dx: true, dy: ['10'], stdDeviation: false, + floodColor: 'purple', floodOpacity: ['0.4']}); ctx.fillRect(210, 210, 80, 80); html_reference: |
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
@@ -521,7 +521,7 @@ {baseFrequency: Infinity}, {baseFrequency: undefined}, {baseFrequency: -Infinity}, - {baseFrequency: "test"}, + {baseFrequency: 'test'}, {numOctaves: {}}, {numOctaves: -1}, @@ -530,7 +530,7 @@ {numOctaves: undefined}, {numOctaves: -Infinity}, {numOctaves: [1, 1]}, - {numOctaves: "test"}, + {numOctaves: 'test'}, {seed: {}}, {seed: NaN}, @@ -538,7 +538,7 @@ {seed: undefined}, {seed: -Infinity}, {seed: [1, 1]}, - {seed: "test"}, + {seed: 'test'}, {stitchTiles: {}}, {stitchTiles: NaN}, @@ -546,14 +546,14 @@ {stitchTiles: undefined}, {stitchTiles: -Infinity}, {stitchTiles: [1, 1]}, - {stitchTiles: "test"}, + {stitchTiles: 'test'}, {stitchTiles: null}, {stitchTiles: []}, {stitchTiles: [10]}, {stitchTiles: 30}, {stitchTiles: false}, {stitchTiles: true}, - {stitchTiles: "10"}, + {stitchTiles: '10'}, {stitchTiles: -1}, {type: {}}, @@ -562,14 +562,14 @@ {type: undefined}, {type: -Infinity}, {type: [1, 1]}, - {type: "test"}, + {type: 'test'}, {type: null}, {type: []}, {type: [10]}, {type: 30}, {type: false}, {type: true}, - {type: "10"}, + {type: '10'}, {type: -1}, ] @@ -582,7 +582,7 @@ {baseFrequency: 30}, {baseFrequency: false}, {baseFrequency: true}, - {baseFrequency: "10"}, + {baseFrequency: '10'}, {numOctaves: null}, {numOctaves: []}, @@ -590,7 +590,7 @@ {numOctaves: 30}, {numOctaves: false}, {numOctaves: true}, - {numOctaves: "10"}, + {numOctaves: '10'}, {seed: null}, {seed: []}, @@ -598,22 +598,22 @@ {seed: 30}, {seed: false}, {seed: true}, - {seed: "10"}, + {seed: '10'}, {seed: -1}, - {stitchTiles: "stitch"}, - {stitchTiles: "noStitch"}, + {stitchTiles: 'stitch'}, + {stitchTiles: 'noStitch'}, - {type: "fractalNoise"}, - {type: "turbulence"}, + {type: 'fractalNoise'}, + {type: 'turbulence'}, ] for (testCase of errorTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; @assert throws TypeError new CanvasFilter(filterOptions); } for (testCase of workingTestCases) { - const filterOptions = {...{filter: "turbulence"}, ...testCase}; + const filterOptions = {...{filter: 'turbulence'}, ...testCase}; @assert new CanvasFilter(filterOptions) != null; }