diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /gfx/tests/reftest/1972885.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/tests/reftest/1972885.html')
-rw-r--r-- | gfx/tests/reftest/1972885.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gfx/tests/reftest/1972885.html b/gfx/tests/reftest/1972885.html new file mode 100644 index 0000000000..49c0ac0c50 --- /dev/null +++ b/gfx/tests/reftest/1972885.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<meta charset="utf-8"> +<title>Test for Bug 1972885</title> +<style> +body { + margin: 0; +} +canvas { + /* Height would round up to 101px, but subpixel snaps to 100. */ + margin-top: 1.6px; + width: 100px; + height: 100.5px; +} +</style> +<canvas id="canvas"></canvas> +<script> +function draw(canvas, width, height) { + const ctx = canvas.getContext('2d'); + canvas.width = width; + canvas.height = height; + const imgData = ctx.createImageData(width, height); + const u32View = new Uint32Array(imgData.data.buffer); + u32View.fill(0xFFFFFFFF); + for (let y = 0; y < height; y += 2) { + for (let x = 0; x < width; x++) { + u32View[y * width + x] = 0xFF000000; + } + } + ctx.putImageData(imgData, 0, 0); +} + +const ro = new ResizeObserver((entries) => { + for (const entry of entries) { + if (entry.target !== canvas) { + continue; + } + draw( + canvas, + entry.devicePixelContentBoxSize[0].inlineSize, + entry.devicePixelContentBoxSize[0].blockSize); + } + document.documentElement.removeAttribute("class"); +}); + +// Get the properly subpixel snapped size through ResizeObserver. +ro.observe(canvas); +</script> |