Bug 1382534 - Account for the local transform in nsSVGClipPathFrame::GetBBoxForClipPathFrame(). r=longsonr draft
authorBotond Ballo <botond@mozilla.com>
Wed, 20 Sep 2017 12:39:59 -0400
changeset 690304 86099814a5fcd7b391c86a471f23337bc345fcdf
parent 690303 6c2b22f28ee648bc93f4cb3471727f992f8cb34e
child 690305 8870b0d92cc7c7ff0e52148197c46de99d597773
push id87277
push userbballo@mozilla.com
push dateWed, 01 Nov 2017 21:17:50 +0000
reviewerslongsonr
bugs1382534
milestone58.0a1
Bug 1382534 - Account for the local transform in nsSVGClipPathFrame::GetBBoxForClipPathFrame(). r=longsonr MozReview-Commit-ID: HbZzPkAZy7q
layout/svg/nsSVGClipPathFrame.cpp
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -475,22 +475,23 @@ nsSVGClipPathFrame::GetClipPathTransform
 
 SVGBBox
 nsSVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox &aBBox,
                                             const gfxMatrix &aMatrix)
 {
   nsIContent* node = GetContent()->GetFirstChild();
   SVGBBox unionBBox, tmpBBox;
   for (; node; node = node->GetNextSibling()) {
-    nsIFrame *frame =
-      static_cast<nsSVGElement*>(node)->GetPrimaryFrame();
+    nsSVGElement* svgNode = static_cast<nsSVGElement*>(node);
+    nsIFrame* frame = svgNode->GetPrimaryFrame();
     if (frame) {
       nsSVGDisplayableFrame* svg = do_QueryFrame(frame);
       if (svg) {
-        tmpBBox = svg->GetBBoxContribution(mozilla::gfx::ToMatrix(aMatrix),
+        gfxMatrix matrix = svgNode->PrependLocalTransformsTo(aMatrix, eUserSpaceToParent);
+        tmpBBox = svg->GetBBoxContribution(mozilla::gfx::ToMatrix(matrix),
                                            nsSVGUtils::eBBoxIncludeFill);
         SVGObserverUtils::EffectProperties effectProperties =
                               SVGObserverUtils::GetEffectProperties(frame);
         if (effectProperties.HasNoOrValidClipPath()) {
           nsSVGClipPathFrame *clipPathFrame =
             effectProperties.GetClipPathFrame();
           if (clipPathFrame) {
             tmpBBox = clipPathFrame->GetBBoxForClipPathFrame(tmpBBox, aMatrix);