Bug 110295

Summary: Transformed SVG background images can be blurry/pixelated
Product: WebKit Reporter: Philip Rogers <pdr>
Component: SVGAssignee: Philip Rogers <pdr>
Status: RESOLVED FIXED    
Severity: Normal CC: d-r, fmalita, japhet, schenney, thorton, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 110442    
Bug Blocks: 109609    
Attachments:
Description Flags
Testcase
none
Account for transform in SVG background images
krit: review+
Update per reviewer comments none

Description Philip Rogers 2013-02-19 20:21:58 PST
Created attachment 189227 [details]
Testcase

When an SVG image is used as a background image and there are CSS transforms, the result can be blurry/pixelated. This is because our buffer used for tiling does not account for CSS transforms.

See the attached testcase for an example.
Comment 1 Philip Rogers 2013-02-19 20:28:13 PST
*** Bug 110272 has been marked as a duplicate of this bug. ***
Comment 2 Philip Rogers 2013-02-19 22:37:06 PST
Created attachment 189246 [details]
Account for transform in SVG background images
Comment 3 Dirk Schulze 2013-02-20 11:42:15 PST
Comment on attachment 189246 [details]
Account for transform in SVG background images

View in context: https://bugs.webkit.org/attachment.cgi?id=189246&action=review

LGTM. Just some snippets.

> Source/WebCore/loader/cache/CachedImage.cpp:198
> +        UNUSED_PARAM(renderer);

indentation wrong.

> Source/WebCore/svg/graphics/SVGImage.cpp:153
> +    ASSERT(imageBufferScale.width() && imageBufferScale.height());

Can you make this two asserts please?

> Source/WebCore/svg/graphics/SVGImage.cpp:159
> +    drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal);

Aren't the last two or three options default for this function anyway? Not sure if we should keep it or remove it.

> LayoutTests/svg/as-background-image/svg-transformed-background.html:17
> +  -ie-transform:scale(5);
> +  -ie-transform-origin:0 0;
> +  -moz-transform:scale(5);
> +  -moz-transform-origin:0 0;

This is unnecessary. please remove these.

> LayoutTests/svg/as-background-image/svg-transformed-background.html:33
> +  -ie-transform:scale(2.5, 10);
> +  -ie-transform-origin:0 0;
> +  -moz-transform:scale(2.5, 10);
> +  -moz-transform-origin:0 0;

ditto.
Comment 4 Philip Rogers 2013-02-20 16:46:17 PST
Created attachment 189414 [details]
Update per reviewer comments
Comment 5 Philip Rogers 2013-02-20 16:51:42 PST
Thank you for the review as always Dirk!

(In reply to comment #3)
> (From update of attachment 189246 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=189246&action=review
> 
> LGTM. Just some snippets.
> 
> > Source/WebCore/loader/cache/CachedImage.cpp:198
> > +        UNUSED_PARAM(renderer);
> 
> indentation wrong.

Fixed.

> 
> > Source/WebCore/svg/graphics/SVGImage.cpp:153
> > +    ASSERT(imageBufferScale.width() && imageBufferScale.height());
> 
> Can you make this two asserts please?

Fixed.

> 
> > Source/WebCore/svg/graphics/SVGImage.cpp:159
> > +    drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal);
> 
> Aren't the last two or three options default for this function anyway? Not sure if we should keep it or remove it.

They aren't default for this one yet. I'd like to hold-off on making these default at the moment, but lets definitely address this in a followup.

> 
> > LayoutTests/svg/as-background-image/svg-transformed-background.html:17
> > +  -ie-transform:scale(5);
> > +  -ie-transform-origin:0 0;
> > +  -moz-transform:scale(5);
> > +  -moz-transform-origin:0 0;
> 
> This is unnecessary. please remove these.

Done.

> 
> > LayoutTests/svg/as-background-image/svg-transformed-background.html:33
> > +  -ie-transform:scale(2.5, 10);
> > +  -ie-transform-origin:0 0;
> > +  -moz-transform:scale(2.5, 10);
> > +  -moz-transform-origin:0 0;
> 
> ditto.

Done.
Comment 6 WebKit Review Bot 2013-02-20 17:21:09 PST
Comment on attachment 189414 [details]
Update per reviewer comments

Clearing flags on attachment: 189414

Committed r143541: <http://trac.webkit.org/changeset/143541>
Comment 7 WebKit Review Bot 2013-02-20 17:21:12 PST
All reviewed patches have been landed.  Closing bug.