diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/html/canvas/offscreen/layers | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/canvas/offscreen/layers')
25 files changed, 585 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html new file mode 100644 index 0000000000..5fc1ac9acd --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter-expected.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.filter</title> +<h1>2d.layer.ctm.filter</h1> +<p class="desc">Checks that parent transforms affect layer filters.</p> + +<svg xmlns="http://www.w3.org/2000/svg" + width="200" height="200" + color-interpolation-filters="sRGB"> + <filter id="filter" x="-100%" y="-100%" width="300%" height="300%"> + <feDropShadow dx="5" dy="5" stdDeviation="0" flood-color="grey" /> + </filter> + + <g filter="url(#filter)"> + <g transform="translate(30, 90) scale(2) rotate(90)"> + <rect x="-30" y="-5" width=60 height=10></rect> + </g> + </g> + + <g transform="translate(80, 90) scale(2) rotate(90)"> + <g filter="url(#filter)"> + <rect x="-30" y="-5" width=60 height=10></rect> + </g> + </g> +</svg> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html new file mode 100644 index 0000000000..e5efc24bcc --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.filter-expected.html"> +<title>Canvas test: 2d.layer.ctm.filter</title> +<h1>2d.layer.ctm.filter</h1> +<p class="desc">Checks that parent transforms affect layer filters.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + // Transforms inside the layer should not apply to the layer's filter. + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.translate(30, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); + + // Transforms in the layer's parent should apply to the layer's filter. + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); + + const outputCanvas = document.getElementById("canvas"); + outputCanvas.getContext('2d').drawImage(canvas, 0, 0); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html new file mode 100644 index 0000000000..760a65e2c8 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.filter.w.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.ctm.filter-expected.html"> +<title>Canvas test: 2d.layer.ctm.filter</title> +<h1>2d.layer.ctm.filter</h1> +<p class="desc">Checks that parent transforms affect layer filters.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + // Transforms inside the layer should not apply to the layer's filter. + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.translate(30, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); + + // Transforms in the layer's parent should apply to the layer's filter. + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + ctx.beginLayer({filter: 'drop-shadow(5px 5px 0px grey)'}); + ctx.fillRect(-30, -5, 60, 10); + ctx.endLayer(); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html new file mode 100644 index 0000000000..b2306d95ac --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>OffscreenCanvas test: 2d.layer.ctm.getTransform</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> + +<h1>2d.layer.ctm.getTransform</h1> +<p class="desc">Tests getTransform inside layers.</p> + + +<script> +var t = async_test("Tests getTransform inside layers."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.translate(10, 20); + ctx.beginLayer(); + ctx.scale(2, 3); + const m = ctx.getTransform(); + assert_array_equals([m.a, m.b, m.c, m.d, m.e, m.f], [2, 0, 0, 3, 10, 20]); + ctx.endLayer(); + t.done(); + +}); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js new file mode 100644 index 0000000000..54b1fee5d0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.getTransform.worker.js @@ -0,0 +1,27 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.layer.ctm.getTransform +// Description:Tests getTransform inside layers. +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Tests getTransform inside layers."); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + + var canvas = new OffscreenCanvas(100, 50); + var ctx = canvas.getContext('2d'); + + ctx.translate(10, 20); + ctx.beginLayer(); + ctx.scale(2, 3); + const m = ctx.getTransform(); + assert_array_equals([m.a, m.b, m.c, m.d, m.e, m.f], [2, 0, 0, 3, 10, 20]); + ctx.endLayer(); + t.done(); +}); +done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html new file mode 100644 index 0000000000..fd4c1746c7 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform-expected.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.resetTransform</title> +<h1>2d.layer.ctm.resetTransform</h1> +<p class="desc">Tests resetTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 20, 20); + + ctx.translate(40, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html new file mode 100644 index 0000000000..9508b34044 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.resetTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.resetTransform</title> +<h1>2d.layer.ctm.resetTransform</h1> +<p class="desc">Tests resetTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = new OffscreenCanvas(100, 50); + const ctx = canvas.getContext('2d'); + + ctx.translate(40, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.resetTransform(); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 20, 20); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + const outputCanvas = document.getElementById("canvas"); + outputCanvas.getContext('2d').drawImage(canvas, 0, 0); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html new file mode 100644 index 0000000000..7bf63e1473 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.resetTransform.w.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.ctm.resetTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.resetTransform</title> +<h1>2d.layer.ctm.resetTransform</h1> +<p class="desc">Tests resetTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(100, 50); + const ctx = canvas.getContext('2d'); + + ctx.translate(40, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.resetTransform(); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 20, 20); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html new file mode 100644 index 0000000000..45a3d095e1 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform-expected.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.setTransform</title> +<h1>2d.layer.ctm.setTransform</h1> +<p class="desc">Tests setTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 0); + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + ctx.setTransform(4, 0, 0, 2, 20, 10); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 10, 10); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html new file mode 100644 index 0000000000..91034943b6 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.setTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.setTransform</title> +<h1>2d.layer.ctm.setTransform</h1> +<p class="desc">Tests setTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = new OffscreenCanvas(100, 50); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.setTransform(4, 0, 0, 2, 20, 10); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 10, 10); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + const outputCanvas = document.getElementById("canvas"); + outputCanvas.getContext('2d').drawImage(canvas, 0, 0); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html new file mode 100644 index 0000000000..8b1ea1ce51 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.setTransform.w.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.ctm.setTransform-expected.html"> +<title>Canvas test: 2d.layer.ctm.setTransform</title> +<h1>2d.layer.ctm.setTransform</h1> +<p class="desc">Tests setTransform inside layers.</p> +<canvas id="canvas" width="100" height="50"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(100, 50); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 0); + + ctx.beginLayer(); + ctx.rotate(2); + ctx.beginLayer(); + ctx.scale(5, 6); + ctx.setTransform(4, 0, 0, 2, 20, 10); + ctx.fillStyle = 'blue'; + ctx.fillRect(0, 0, 10, 10); + ctx.endLayer(); + ctx.endLayer(); + + ctx.fillStyle = 'green'; + ctx.fillRect(0, 0, 20, 20); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html new file mode 100644 index 0000000000..312ca19b4c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer-expected.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title> +<h1>2d.layer.ctm.shadow-in-transformed-layer</h1> +<p class="desc">Check shadows inside of a transformed layer.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'grey'; + ctx.fillRect(-30, -5, 60, 10); + + const canvas2 = new OffscreenCanvas(100, 100); + const ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = 'blue'; + ctx2.fillRect(0, 0, 40, 10); + ctx.drawImage(canvas2, -30, -30); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html new file mode 100644 index 0000000000..59305076f0 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html"> +<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title> +<h1>2d.layer.ctm.shadow-in-transformed-layer</h1> +<p class="desc">Check shadows inside of a transformed layer.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + + ctx.beginLayer(); + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'grey'; + ctx.fillRect(-30, -5, 60, 10); + + const canvas2 = new OffscreenCanvas(100, 100); + const ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = 'blue'; + ctx2.fillRect(0, 0, 40, 10); + ctx.drawImage(canvas2, -30, -30); + + ctx.endLayer(); + + const outputCanvas = document.getElementById("canvas"); + outputCanvas.getContext('2d').drawImage(canvas, 0, 0); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html new file mode 100644 index 0000000000..486a028335 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.ctm.shadow-in-transformed-layer.w.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.ctm.shadow-in-transformed-layer-expected.html"> +<title>Canvas test: 2d.layer.ctm.shadow-in-transformed-layer</title> +<h1>2d.layer.ctm.shadow-in-transformed-layer</h1> +<p class="desc">Check shadows inside of a transformed layer.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + ctx.translate(80, 90); + ctx.scale(2, 2); + ctx.rotate(Math.PI / 2); + + ctx.beginLayer(); + ctx.shadowOffsetX = 10; + ctx.shadowOffsetY = 10; + ctx.shadowColor = 'grey'; + ctx.fillRect(-30, -5, 60, 10); + + const canvas2 = new OffscreenCanvas(100, 100); + const ctx2 = canvas2.getContext('2d'); + ctx2.fillStyle = 'blue'; + ctx2.fillRect(0, 0, 40, 10); + ctx.drawImage(canvas2, -30, -30); + + ctx.endLayer(); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html new file mode 100644 index 0000000000..26f6e75214 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage-expected.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.layer.drawImage</title> +<h1>2d.layer.drawImage</h1> +<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = document.getElementById("canvas"); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'skyblue'; + ctx.fillRect(0, 0, 100, 100); + + ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10, + stdDeviation: 0, floodColor: 'navy'}}); + + ctx.fillStyle = 'maroon'; + ctx.fillRect(20, 20, 50, 50); + + ctx.globalCompositeOperation = 'xor'; + + // Should xor only with the layer content, not the parents'. + ctx.fillStyle = 'pink'; + ctx.fillRect(40, 40, 50, 50); + + ctx.endLayer(); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html new file mode 100644 index 0000000000..37718f6f2c --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<link rel="match" href="2d.layer.drawImage-expected.html"> +<title>Canvas test: 2d.layer.drawImage</title> +<h1>2d.layer.drawImage</h1> +<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script> + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'skyblue'; + ctx.fillRect(0, 0, 100, 100); + + ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10, + stdDeviation: 0, floodColor: 'navy'}}); + + ctx.fillStyle = 'maroon'; + ctx.fillRect(20, 20, 50, 50); + + ctx.globalCompositeOperation = 'xor'; + + // The image should xor only with the layer content, not the parents'. + const canvas_image = new OffscreenCanvas(200,200); + const ctx_image = canvas_image.getContext("2d"); + ctx_image.fillStyle = 'pink'; + ctx_image.fillRect(40, 40, 50, 50); + ctx.drawImage(canvas_image, 0, 0); + + ctx.endLayer(); + + const outputCanvas = document.getElementById("canvas"); + outputCanvas.getContext('2d').drawImage(canvas, 0, 0); +</script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html new file mode 100644 index 0000000000..78a235597d --- /dev/null +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.drawImage.w.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<html class="reftest-wait"> +<link rel="match" href="2d.layer.drawImage-expected.html"> +<title>Canvas test: 2d.layer.drawImage</title> +<h1>2d.layer.drawImage</h1> +<p class="desc">Checks that drawImage writes the image to the layer and not the parent directly.</p> +<canvas id="canvas" width="200" height="200"> + <p class="fallback">FAIL (fallback content)</p> +</canvas> +<script id='myWorker' type='text/worker'> + self.onmessage = function(e) { + const canvas = new OffscreenCanvas(200, 200); + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = 'skyblue'; + ctx.fillRect(0, 0, 100, 100); + + ctx.beginLayer({filter: {name: 'dropShadow', dx: -10, dy: -10, + stdDeviation: 0, floodColor: 'navy'}}); + + ctx.fillStyle = 'maroon'; + ctx.fillRect(20, 20, 50, 50); + + ctx.globalCompositeOperation = 'xor'; + + // The image should xor only with the layer content, not the parents'. + const canvas_image = new OffscreenCanvas(200,200); + const ctx_image = canvas_image.getContext("2d"); + ctx_image.fillStyle = 'pink'; + ctx_image.fillRect(40, 40, 50, 50); + ctx.drawImage(canvas_image, 0, 0); + + ctx.endLayer(); + + const bitmap = canvas.transferToImageBitmap(); + self.postMessage(bitmap, bitmap); + }; +</script> +<script> + const blob = new Blob([document.getElementById('myWorker').textContent]); + const worker = new Worker(URL.createObjectURL(blob)); + worker.addEventListener('message', msg => { + const outputCtx = document.getElementById("canvas").getContext('2d'); + outputCtx.drawImage(msg.data, 0, 0); + document.documentElement.classList.remove("reftest-wait"); + }); + worker.postMessage(null); +</script> +</html> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html index be6f962b33..0e48cb49f7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-2453"> <title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> <h1>2d.layer.global-states.filter.alpha.blending</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html index 2b53ad7c1e..3887ed4485 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.blending.w.html @@ -2,6 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> <link rel="match" href="2d.layer.global-states.filter.alpha.blending-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-2453"> <title>Canvas test: 2d.layer.global-states.filter.alpha.blending</title> <h1>2d.layer.global-states.filter.alpha.blending</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html index 087fea88af..1a9bc8b733 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-5204"> <title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> <h1>2d.layer.global-states.filter.alpha.composite</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html index 6aa83a3278..5c90fe95aa 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.composite.w.html @@ -2,6 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> <link rel="match" href="2d.layer.global-states.filter.alpha.composite-expected.html"> +<meta name=fuzzy content="maxDifference=0-1; totalPixels=0-5204"> <title>Canvas test: 2d.layer.global-states.filter.alpha.composite</title> <h1>2d.layer.global-states.filter.alpha.composite</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html index f1d631c25c..f64e8925f0 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6766"> <title>Canvas test: 2d.layer.global-states.filter.alpha</title> <h1>2d.layer.global-states.filter.alpha</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html index 2548c21181..5e8911ee17 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.html @@ -1,6 +1,7 @@ <!DOCTYPE html> <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6311"> <title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> <h1>2d.layer.global-states.filter.alpha.shadow</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html index 5e1494422e..b3be7e1ac8 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.shadow.w.html @@ -2,6 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> <link rel="match" href="2d.layer.global-states.filter.alpha.shadow-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6311"> <title>Canvas test: 2d.layer.global-states.filter.alpha.shadow</title> <h1>2d.layer.global-states.filter.alpha.shadow</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html index e75d668ad5..21e55f856c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.global-states.filter.alpha.w.html @@ -2,6 +2,7 @@ <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> <html class="reftest-wait"> <link rel="match" href="2d.layer.global-states.filter.alpha-expected.html"> +<meta name=fuzzy content="maxDifference=0-2; totalPixels=0-6766"> <title>Canvas test: 2d.layer.global-states.filter.alpha</title> <h1>2d.layer.global-states.filter.alpha</h1> <p class="desc">Checks that layers with filters correctly use global render states.</p> |