2 <html class=
"reftest-wait">
4 <title>Test for Bug
1972885</title>
10 /* Height would round up to
101px, but subpixel snaps to
100. */
16 <canvas id=
"canvas"></canvas>
18 function draw(canvas
, width
, height
) {
19 const ctx
= canvas
.getContext('2d');
21 canvas
.height
= height
;
22 const imgData
= ctx
.createImageData(width
, height
);
23 const u32View
= new Uint32Array(imgData
.data
.buffer
);
24 u32View
.fill(0xFFFFFFFF);
25 for (let y
= 0; y
< height
; y
+= 2) {
26 for (let x
= 0; x
< width
; x
++) {
27 u32View
[y
* width
+ x
] = 0xFF000000;
30 ctx
.putImageData(imgData
, 0, 0);
33 const ro
= new ResizeObserver((entries
) => {
34 for (const entry
of entries
) {
35 if (entry
.target
!== canvas
) {
40 entry
.devicePixelContentBoxSize
[0].inlineSize
,
41 entry
.devicePixelContentBoxSize
[0].blockSize
);
43 document
.documentElement
.removeAttribute("class");
46 // Get the properly subpixel snapped size through ResizeObserver.