When using a viewbox attribute that results in upscaling, text gradient fills are rendered incorrectly.
Created attachment 146825 [details] RefTests
Comment on attachment 146825 [details] RefTests This reftest shows the issue. The gradient should scale from red over green to blue over the size of the text, same in both cases - with viewbox and without.
The issue seems to be with identifying the bounding box of small-scale text. Origin of bounding box for the text in LayoutTests/svg/transforms/viewbox-text-fill-gradient.html is 0,0 - extents are 1,1 - while these should be precise float values.
In my understanding, the rounding happens in void SVGRootInlineBox::layoutRootBox(). Using LayoutUnits here, would only improve the results but not fix the issue completely - we need higher precision for the text bounding boxes.
Probably same root cause as bug 75781.
This issue persists even after landing patch from bug 107771.
I took the test case from the attached patch and turned into JSFiddle and also added missing </rect>: JSFiddle - https://jsfiddle.net/9z4Ljr7y/show Safari 16.2, Safari Technology Preview 161, Chrome Canary 111 and Firefox Nightly 111 are matching other, do we need to track anything else? Thanks!