The default bug view has changed. See this FAQ.

Make nsDisplayTransform take account of zooming for SVG transforms

RESOLVED FIXED in mozilla17

Status

()

Core
SVG
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jwatt, Assigned: jwatt)

Tracking

Trunk
mozilla17
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
nsDisplayTransform needs to take account of zooming in the translation components of SVG transforms.
(Assignee)

Comment 1

5 years ago
Created attachment 642451 [details] [diff] [review]
patch
Attachment #642451 - Flags: review?(roc)
(Assignee)

Updated

5 years ago
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.
(Assignee)

Comment 4

5 years ago
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.
Attachment #642451 - Attachment is obsolete: true
Attachment #642451 - Flags: review?(roc)
Attachment #643317 - Flags: review?(roc)
Attachment #643317 - Flags: review?(roc) → review+
(Assignee)

Comment 5

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/4a0746d9a89f
Target Milestone: --- → mozilla17
https://hg.mozilla.org/mozilla-central/rev/4a0746d9a89f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.