Last Comment Bug 774133 - Make nsDisplayTransform take account of zooming for SVG transforms
: Make nsDisplayTransform take account of zooming for SVG transforms
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla17
Assigned To: Jonathan Watt [:jwatt]
:
Mentors:
Depends on:
Blocks: 614732
  Show dependency treegraph
 
Reported: 2012-07-15 17:34 PDT by Jonathan Watt [:jwatt]
Modified: 2012-07-19 07:36 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (2.04 KB, patch)
2012-07-15 17:35 PDT, Jonathan Watt [:jwatt]
no flags Details | Diff | Review
patch (2.12 KB, patch)
2012-07-18 04:43 PDT, Jonathan Watt [:jwatt]
roc: review+
Details | Diff | Review

Description Jonathan Watt [:jwatt] 2012-07-15 17:34:42 PDT
nsDisplayTransform needs to take account of zooming in the translation components of SVG transforms.
Comment 1 Jonathan Watt [:jwatt] 2012-07-15 17:35:43 PDT
Created attachment 642451 [details] [diff] [review]
patch
Comment 2 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-07-16 06:42:25 PDT
Comment on attachment 642451 [details] [diff] [review]
patch

Review of attachment 642451 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/base/nsDisplayList.cpp
@@ +2784,1 @@
>      result = gfx3DMatrix::From2D(svgTransform);

Don't we need to scale the whole transform here?

@@ +2791,5 @@
>    if (hasSVGTransforms && !transformFromSVGParent.IsIdentity()) {
> +    // Correct translation components for zoom:
> +    float devPixelsPerCSSPx = aFrame->PresContext()->CSSPixelsToDevPixels(1.0f);
> +    transformFromSVGParent.x0 *= devPixelsPerCSSPx;
> +    transformFromSVGParent.y0 *= devPixelsPerCSSPx;

Don't we need to scale the whole transform here?
Comment 3 Matt Woodrow (:mattwoodrow) 2012-07-17 13:01:05 PDT
I don't think we need to, no. Only the 'translation' components of the matrix have units (CSS pixels in this case) and need to be converted, the rest are just scale factors and can't have their units converted.

We also shouldn't be converting to dev pixels here, we should instead convert into AppUnits, and then use the passed in aAppUnitsPerPixel to convert into the correct pixel type. Some of the callers to this function are using AppUnitsPerCSSPixel(), and converting to dev pixels will change this behaviour.
Comment 4 Jonathan Watt [:jwatt] 2012-07-18 04:43:08 PDT
Created attachment 643317 [details] [diff] [review]
patch

(In reply to Matt Woodrow (:mattwoodrow) from comment #3)
> We also shouldn't be converting to dev pixels here, we should instead
> convert into AppUnits, and then use the passed in aAppUnitsPerPixel to
> convert into the correct pixel type.

Good point.
Comment 6 Ed Morley [:emorley] 2012-07-19 07:36:38 PDT
https://hg.mozilla.org/mozilla-central/rev/4a0746d9a89f

Note You need to log in before you can comment on or make changes to this bug.