Bug 135616

Summary: SVGRenderingContext::createImageBuffer is not retina (2x) compatible (affects <mask>)
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: dino, sabouhallawa, simon.fraser, thaddee.tyl, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=166750
Bug Depends on:    
Bug Blocks: 151737    
Attachments:
Description Flags
Test case: the two circles should look identical. none

Description Timothy Hatcher 2014-08-05 12:02:45 PDT
SVGRenderingContext::createImageBuffer always makes a 1x buffer. This makes <mask> and maybe other things always use 1x on 2x devices.

We really need to audit all places that call ImageBuffer::create with a hardcoded 1!

(This was going to affect Web Inspector but I was able to use <clipPath> instead.)
Comment 1 Radar WebKit Bug Importer 2015-04-10 16:45:32 PDT
<rdar://problem/20506912>
Comment 2 Thaddee Tyl 2016-12-14 14:53:03 PST
Created attachment 297130 [details]
Test case: the two circles should look identical.

I would like to point out that this is not just an issue for Retina screens; it also affects zoomed in pages (either manually or through CSS).
Comment 3 Said Abou-Hallawa 2017-01-05 18:05:49 PST
I do not think we currently have a problem in SVGRenderingContext::createImageBuffer() when calling ImageBuffer::create(). Yes, we are still sending resolutionScale = 1 to ImageBuffer::create() but this is correct. We send absoluteTransform = zooming_factor * device_scaling to SVGRenderingContext::createImageBuffer() which uses it to scale the ImageBuffer bitmap and to transform its context accordingly. So the caller (RenderSVGResourceMasker::applyResource() in this case) can still draw using logical units on the ImageBuffer.

Regarding the new test case, I think it is unrelated to this bug. It is related to displaying an <img> element whose src is an SVG data uri. In this case, we do not respect the zooming_factor because the SVG root element belongs to an SVGDocument which does not inherit the deviceScaleFactor of the containing HTMLDocument.

I am going to close this bug and open a new one for the data uri case.
Comment 4 Said Abou-Hallawa 2017-01-05 18:22:32 PST
See https://bugs.webkit.org/show_bug.cgi?id=166750