Bug 135616 - SVGRenderingContext::createImageBuffer is not retina (2x) compatible (affects <mask>)
Summary: SVGRenderingContext::createImageBuffer is not retina (2x) compatible (affects...
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Blocks: 151737
  Show dependency treegraph
Reported: 2014-08-05 12:02 PDT by Timothy Hatcher
Modified: 2017-01-05 18:22 PST (History)
6 users (show)

See Also:

Test case: the two circles should look identical. (664 bytes, text/html)
2016-12-14 14:53 PST, Thaddee Tyl
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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
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