It seems that when downscaling a HTML canvas by factor F, and drawing an image with SVG source, upscaled by factor F, iOS 15 Safari crashes when F is large enough, even though these two factors should cancel out (1/F * F = 1).
I think it will draw the SVG to an intermediate texture F times the size of the SVG, in this case (F*1000)^2 pixels => kaboom.
This is a regression because it works on all other browsers, and works fine in iOS 13 and 14 Safari.
To reproduce, visit https://codepen.io/Ziriax/full/LYLgYxp
It seems Safari TP on OSX also crashes
GPU process, maybe?
I cannot reproduce this on macOS 12 beta with Safari 15.1 on Apple Silicon, nor with STP 132, for what it's worth.
I can see vastly higher memory usage on macOS 12 beta with Safari 15.1 on Intel and vastly worse performance than Firefox Nightly or Chrome Canary. On the whole my assumption is the crash is "simply" OOM.
I'd presume that Firefox and Chrome are cancelling out the factors and therefore they don't actually do anything.
GPU Process forced us to draw SVGs into an image buffer and then draw that to the canvas. That's probably the cause of the regression.
I see, that was what I expected.
So some extra logic should be added to compute the minimal size of such an intermediate texture. If the world canvas transform is known, and the dimensions of the canvas, that is not too difficult IMHO?
Created attachment 442208 [details]
Simple test case (Should show a green rectangle)
Created attachment 442212 [details]
Committed r284740 (243449@main): <https://commits.webkit.org/243449@main>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 442212 [details].
*** Bug 231796 has been marked as a duplicate of this bug. ***
Could you tip when it will be in the new safari version?
(In reply to Roman Nikitin from comment #12)
> Could you tip when it will be in the new safari version?
Apple does not comment on future releases.