Bug 1382534 - Use clip-rule instead of fill-rule when calculating the bounding box contribution of an SVG geometry frame inside a clip-path. r=longsonr draft
authorBotond Ballo <botond@mozilla.com>
Mon, 25 Sep 2017 16:57:39 -0400
changeset 690306 68690f54ea5129863dc5cfb3f4095c22e41409ad
parent 690305 8870b0d92cc7c7ff0e52148197c46de99d597773
child 690307 7a585b57308eeefe00c2cb5c334bcfa39f11ab93
push id87277
push userbballo@mozilla.com
push dateWed, 01 Nov 2017 21:17:50 +0000
reviewerslongsonr
bugs1382534
milestone58.0a1
Bug 1382534 - Use clip-rule instead of fill-rule when calculating the bounding box contribution of an SVG geometry frame inside a clip-path. r=longsonr MozReview-Commit-ID: 1rAKmp2ET6A
layout/svg/SVGGeometryFrame.cpp
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -538,17 +538,20 @@ SVGGeometryFrame::GetBBoxContribution(co
     RefPtr<gfxASurface> refSurf =
       gfxPlatform::GetPlatform()->ScreenReferenceSurface();
     tmpDT = gfxPlatform::GetPlatform()->
       CreateDrawTargetForSurface(refSurf, IntSize(1, 1));
 #else
     tmpDT = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
 #endif
 
-    FillRule fillRule = nsSVGUtils::ToFillRule(StyleSVG()->mFillRule);
+    FillRule fillRule = nsSVGUtils::ToFillRule(
+        (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD)
+      ? StyleSVG()->mClipRule
+      : StyleSVG()->mFillRule);
     RefPtr<Path> pathInUserSpace = element->GetOrBuildPath(*tmpDT, fillRule);
     if (!pathInUserSpace) {
       return bbox;
     }
     RefPtr<Path> pathInBBoxSpace;
     if (aToBBoxUserspace.IsIdentity()) {
       pathInBBoxSpace = pathInUserSpace;
     } else {