From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- layout/svg/SVGGeometryFrame.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'layout/svg/SVGGeometryFrame.cpp') diff --git a/layout/svg/SVGGeometryFrame.cpp b/layout/svg/SVGGeometryFrame.cpp index 7d0bd7cc4c..3d6d6aef7e 100644 --- a/layout/svg/SVGGeometryFrame.cpp +++ b/layout/svg/SVGGeometryFrame.cpp @@ -358,13 +358,31 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace, SVGGeometryElement* element = static_cast(GetContent()); - bool getFill = (aFlags & SVGUtils::eBBoxIncludeFillGeometry) || - ((aFlags & SVGUtils::eBBoxIncludeFill) && - !StyleSVG()->mFill.kind.IsNone()); - - bool getStroke = - (aFlags & SVGUtils::eBBoxIncludeStrokeGeometry) || - ((aFlags & SVGUtils::eBBoxIncludeStroke) && SVGUtils::HasStroke(this)); + const bool getFill = (aFlags & SVGUtils::eBBoxIncludeFillGeometry) || + ((aFlags & SVGUtils::eBBoxIncludeFill) && + !StyleSVG()->mFill.kind.IsNone()); + + const bool getStroke = + ((aFlags & SVGUtils::eBBoxIncludeStrokeGeometry) || + ((aFlags & SVGUtils::eBBoxIncludeStroke) && + SVGUtils::HasStroke(this))) && + // If this frame has non-scaling-stroke and we would like to compute its + // stroke, it may cause a potential cyclical dependency if the caller is + // for transform. In this case, we have to fall back to fill-box, so make + // |getStroke| be false. + // https://github.com/w3c/csswg-drafts/issues/9640 + // + // Note: + // 1. We don't care about the computation of the markers below in this + // function because we know the callers don't set + // SVGUtils::eBBoxIncludeMarkers. + // See nsStyleTransformMatrix::GetSVGBox() and + // MotionPathUtils::GetRayContainReferenceSize() for more details. + // 2. We have to break the dependency here *again* because the geometry + // frame may be in the subtree of a SVGContainerFrame, which may not + // set non-scaling-stroke. + !(StyleSVGReset()->HasNonScalingStroke() && + (aFlags & SVGUtils::eAvoidCycleIfNonScalingStroke)); SVGContentUtils::AutoStrokeOptions strokeOptions; if (getStroke) { -- cgit v1.2.3