Bug 253821

Summary: Offscreen Canvas does not respect size set via CSS
Product: WebKit Reporter: Oscar <oscarbouwmans>
Component: CanvasAssignee: Matt Woodrow <mattwoodrow>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, Hironori.Fujii, mattwoodrow, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: macOS 13   
Attachments:
Description Flags
Screenshots of the bug in Safari Technology Preview and another browser side by side. none

Description Oscar 2023-03-13 06:44:35 PDT
Created attachment 465417 [details]
Screenshots of the bug in Safari Technology Preview and another browser side by side.

Example:
Given the canvas has HTML attributes width=200 and height=200;
when the CSS rules width:100px and height:100px are applied,
the OffscreenCanvas renders at original 200x200 scale, overflowing the box of 100x100.

Please find an example in the attached screenshot, and a simple reproduction case here:
https://stackblitz.com/edit/webkit-offscreen-canvas-scaling
Comment 1 Radar WebKit Bug Importer 2023-03-20 06:45:16 PDT
<rdar://problem/106941318>
Comment 2 Matt Woodrow 2023-03-20 16:55:37 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11743
Comment 3 EWS 2023-03-23 14:28:29 PDT
Committed 262039@main (2d31dae22ea7): <https://commits.webkit.org/262039@main>

Reviewed commits have been landed. Closing PR #11743 and removing active labels.
Comment 4 Fujii Hironori 2023-03-24 00:47:40 PDT
fast/canvas/offscreen-scaling.html is randomly failing.
https://results.webkit.org/?suite=layout-tests&test=fast%2Fcanvas%2Foffscreen-scaling.html