Bug 1348564 - Part 3. Fix assertion in nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame.
This issue exists even before we landed
bug 1320036.
nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame is called under the following
conditions:
1. (Before
bug 1320036 landed)
The target frame is not inherited from nsISVGChildFrame or is not an SVG frame.
2. (After
bug 1320036 landed)
The target frame is not inherited from nsISVGChildFrame or is not an SVG frame,
except SVG-outer frame.
So if you pass a nsGradientFrame object, which is not inherited from nsISVGChildFrame,
to nsSVGUtils::GetBBox, this assertion always fails.
MozReview-Commit-ID: IvQApquMPhp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -187,18 +187,24 @@ nsSVGIntegrationUtils::GetSVGCoordContex
nsPresContext* presContext = firstFrame->PresContext();
return gfx::Size(presContext->AppUnitsToFloatCSSPixels(r.width),
presContext->AppUnitsToFloatCSSPixels(r.height));
}
gfxRect
nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(nsIFrame* aNonSVGFrame)
{
- NS_ASSERTION(!(aNonSVGFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT),
- "Frames with SVG layout should not get here");
+#ifdef DEBUG
+ const bool hasSVGLayout = aNonSVGFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT;
+ nsISVGChildFrame* svg = do_QueryFrame(aNonSVGFrame);
+ NS_ASSERTION(!hasSVGLayout || !svg,
+ "Frames with SVG layout or inherited from nsISVGChildFrame"
+ "should not get here");
+#endif
+
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
// 'r' is in "user space":
nsRect r = GetPreEffectsVisualOverflowUnion(firstFrame, nullptr, nsRect(),
GetOffsetToBoundingBox(firstFrame));
return nsLayoutUtils::RectToGfxRect(r,
aNonSVGFrame->PresContext()->AppUnitsPerCSSPixel());
}