Bug 99874 - [Chromium] SVG repaint issues
Summary: [Chromium] SVG repaint issues
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:32 PDT by Florin Malita
Modified: 2012-10-25 06:05 PDT (History)
9 users (show)

See Also:


Attachments
Leaves unpainted artifacts when shrinking (4.79 KB, text/html)
2012-10-19 14:32 PDT, Florin Malita
no flags Details
Updated test. (865 bytes, text/html)
2012-10-22 08:00 PDT, Florin Malita
no flags Details
Screenshot of observed ghosting. (2.87 KB, image/png)
2012-10-22 08:20 PDT, Florin Malita
no flags Details
Patch (105.68 KB, patch)
2012-10-24 10:23 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:32:29 PDT
Created attachment 169697 [details]
Leaves unpainted artifacts when shrinking

When scaling (shrinking) SVG shapes dynamically, the old area is not always fully repainted.
Comment 1 Florin Malita 2012-10-22 07:00:16 PDT
Not limited to scaling, see http://code.google.com/p/chromium/issues/detail?id=156597
Comment 2 Florin Malita 2012-10-22 08:00:47 PDT
Created attachment 169909 [details]
Updated test.

The initial test only exhibits the issue for certain browser window sizes. Updated.
Comment 3 Florin Malita 2012-10-22 08:08:56 PDT
Also, this appears to be Chromium-only.
Comment 4 Florin Malita 2012-10-22 08:20:34 PDT
Created attachment 169917 [details]
Screenshot of observed ghosting.
Comment 5 Florin Malita 2012-10-24 07:33:16 PDT
I tracked this down to accumulated rounding errors in SVGRenderRoot::paintReplaced() when using subpixel layout:

     IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
     childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffset.x() - x(), adjustedPaintOffset.y() - y()) * localToParentTransform());

The problem is we're rounding layout units both for adjustedPaintOffset and in localToParentTransform() and effectively adding the results => we're getting 2x the rounding delta. If the delta happens to be 1/2 pixles then we end up being off by one pixel, which skews the painting/repainting rects.

We can either adjust by one in the special case of rounding delta == 0.5, or use localToBorderBoxTransform() to avoid getting the delta injected twice. I'll put a patch up shortly.
Comment 6 Florin Malita 2012-10-24 10:23:03 PDT
Created attachment 170422 [details]
Patch
Comment 7 Florin Malita 2012-10-24 10:25:20 PDT
Not sure whether subpixel layout is used on other platforms besides Chromium - if it is we'll have to add new expectations to the patch.
Comment 8 Levi Weintraub 2012-10-24 10:28:11 PDT
Comment on attachment 170422 [details]
Patch

LGTM. Thank you.
Comment 9 Levi Weintraub 2012-10-24 10:28:40 PDT
(In reply to comment #7)
> Not sure whether subpixel layout is used on other platforms besides Chromium - if it is we'll have to add new expectations to the patch.

Not yet, no.
Comment 10 WebKit Review Bot 2012-10-24 11:14:12 PDT
Comment on attachment 170422 [details]
Patch

Clearing flags on attachment: 170422

Committed r132377: <http://trac.webkit.org/changeset/132377>
Comment 11 WebKit Review Bot 2012-10-24 11:14:16 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Florin Malita 2012-10-25 06:05:38 PDT
Committed r132477: <http://trac.webkit.org/changeset/132477>