Bug 99870 - Incorrect pattern scaling
Summary: Incorrect pattern scaling
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Florin Malita
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-19 14:20 PDT by Florin Malita
Modified: 2012-10-19 19:51 PDT (History)
8 users (show)

See Also:


Attachments
"Wobbly" pattern scaling (4.63 KB, text/html)
2012-10-19 14:20 PDT, Florin Malita
no flags Details
Patch (321.56 KB, patch)
2012-10-19 15:06 PDT, Florin Malita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florin Malita 2012-10-19 14:20:29 PDT
Created attachment 169693 [details]
"Wobbly" pattern scaling

SVG patterns do not scale smoothly with arbitrary factors. Certain values cause the pattern to shift around visibly.

Chromium issue: http://code.google.com/p/chromium/issues/detail?id=125638
Comment 1 Dirk Schulze 2012-10-19 14:23:02 PDT
And repaint issues as well.
Comment 2 Florin Malita 2012-10-19 14:24:08 PDT
(In reply to comment #1)
> And repaint issues as well.

Yes, that too. I'd like to handle that as a separate bug though.
Comment 3 Florin Malita 2012-10-19 15:06:08 PDT
Created attachment 169704 [details]
Patch
Comment 4 Dirk Schulze 2012-10-19 15:15:45 PDT
Comment on attachment 169704 [details]
Patch

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

> Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp:131
> +        patternData->transform.scale(tileBoundaries.width() / tileImageSize.width(), tileBoundaries.height() / tileImageSize.height());

I can't really tell if that is fully correct, even if it looks sane. I would like to have an easy example where you can see the wrong scaling behavior (sth. with red wrong, just green correct).
Comment 5 Florin Malita 2012-10-19 17:27:39 PDT
(In reply to comment #4)
> (From update of attachment 169704 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=169704&action=review
> 
> > Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp:131
> > +        patternData->transform.scale(tileBoundaries.width() / tileImageSize.width(), tileBoundaries.height() / tileImageSize.height());
> 
> I can't really tell if that is fully correct, even if it looks sane. I would like to have an easy example where you can see the wrong scaling behavior (sth. with red wrong, just green correct).

I tried making it a reftest initially, but there are subtle subpixel differences and couldn't make it work. Since this deals with pattern tile alignment, I can't really think of a way to make it turn red when misaligned... do you have any ideas?

But if you open the added test in an unpatched build you can notice that the pattern doesn't align on the right side for all scales as it is supposed to (the shape size is a multiple of the pattern size). The pixel results capture this, and I guess I could add a comment explaining how it should look.
Comment 6 Dirk Schulze 2012-10-19 19:17:11 PDT
Can you add a pixel test then?
Comment 7 Florin Malita 2012-10-19 19:26:52 PDT
(In reply to comment #6)
> Can you add a pixel test then?

There is this one I was talking about added in the patch: svg/custom/pattern-scaling.svg (green/yellow squares pattern that should align on all rect edges)

I only have Chromium/Linux results for it, but will add the rest as they become available.

Do you think we need some more?
Comment 8 Dirk Schulze 2012-10-19 19:30:07 PDT
Comment on attachment 169704 [details]
Patch

I missed the new test, sorry. Looks fine for me.
Comment 9 WebKit Review Bot 2012-10-19 19:51:12 PDT
Comment on attachment 169704 [details]
Patch

Clearing flags on attachment: 169704

Committed r131974: <http://trac.webkit.org/changeset/131974>
Comment 10 WebKit Review Bot 2012-10-19 19:51:18 PDT
All reviewed patches have been landed.  Closing bug.