Bug 1348564 - Part 3. More comment in nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame. draft
authorcku <cku@mozilla.com>
Wed, 22 Mar 2017 15:53:55 +0800
changeset 503024 d1e2a786f0efbff2c0f51cedc0fa3e8d79e02ddc
parent 503023 c486df1d2b56ef136d1edf036bcfcfbc5740a6cc
child 550311 176c5015acb7076ee0c1b088a997491bd786f166
push id50457
push userbmo:cku@mozilla.com
push dateWed, 22 Mar 2017 17:25:35 +0000
bugs1348564
milestone55.0a1
Bug 1348564 - Part 3. More comment in nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame. MozReview-Commit-ID: Gq9vLmqrcjy
layout/svg/nsSVGIntegrationUtils.cpp
--- 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)
 {
+  // Except for nsSVGOuterSVGFrame, we shouldn't be getting here with SVG
+  // frames at all. This function is for elements that are laid out using the
+  // CSS box model rules.
   NS_ASSERTION(!(aNonSVGFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT),
                "Frames with SVG layout should not get here");
+  MOZ_ASSERT_IF(aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
+                aNonSVGFrame->GetType() == nsGkAtoms::svgOuterSVGFrame);
+
   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());
 }