Bug 1325865 - Part 1. Remove double transform. r=longsonr+218550

For an SVG container element(such as g/svg etc) used in mask, we apply
transform of it twice:
1. The first time is in nsSVGMaskFrame::GetMaskForMaskedFrame. We apply
   transform by eAllTransforms(= eUserSpaceToParent + eChildToUserSpace)
2. The second time is in nsSVGDisplayContainerFrame::PaintSVG. We apply
   transform by eChildToUserSpace

So, totally we apply 1 * eUserSpaceToParent + 2 * eChildToUserSpace. This
patch is trying to remove this one extra eChildToUserSpace.

MozReview-Commit-ID: 2pQCsrCIPNA

--HG--
extra : rebase_source : 27fe1648eb80d9c4d5111bbaec7ec38d80a0a8ac
This commit is contained in:
cku 2017-01-13 17:02:09 +08:00
parent 32f337db55
commit d476a5e983
2 changed files with 9 additions and 2 deletions

View File

@ -284,9 +284,16 @@ SVGGeometryFrame::PaintSVG(gfxContext& aContext,
if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS;
gfxMatrix childToUserSpace = aTransform;
if (GetContent()->IsSVGElement()) {
childToUserSpace = static_cast<const nsSVGElement*>(GetContent())->
PrependLocalTransformsTo(childToUserSpace,
eChildToUserSpace);
}
// Matrix to the geometry's user space:
gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
aContext.CurrentMatrix().PreMultiply(childToUserSpace).NudgeToIntegers();
if (newMatrix.IsSingular()) {
return DrawResult::BAD_ARGS;
}

View File

@ -262,7 +262,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
gfxMatrix m = mMatrixForChildren;
if (kid->GetContent()->IsSVGElement()) {
m = static_cast<nsSVGElement*>(kid->GetContent())->
PrependLocalTransformsTo(m);
PrependLocalTransformsTo(m, eUserSpaceToParent);
}
result = nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m);
if (result != DrawResult::SUCCESS) {