Closed Bug 774133 Opened 12 years ago Closed 12 years ago

Make nsDisplayTransform take account of zooming for SVG transforms

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(1 file, 1 obsolete file)

nsDisplayTransform needs to take account of zooming in the translation components of SVG transforms.
Attached patch patch (obsolete) — Splinter Review
Attachment #642451 - Flags: review?(roc)
Blocks: 614732
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?
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.
Attached patch patchSplinter Review
(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.
Attachment #642451 - Attachment is obsolete: true
Attachment #642451 - Flags: review?(roc)
Attachment #643317 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/4a0746d9a89f
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: