Bug 1287492 - Part 2. Rewrite nsSVGUtils::GetNearestSVGViewport
GetNearestSVGViewport is not used anymore, rewrite it, Part 3 will need this new
version.
MozReview-Commit-ID: GNJXICG9akj
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -143,31 +143,30 @@ nsSVGUtils::Init()
Preferences::AddBoolVarCache(&sSVGDisplayListPaintingEnabled,
"svg.display-lists.painting.enabled");
Preferences::AddBoolVarCache(&sSVGNewGetBBoxEnabled,
"svg.new-getBBox.enabled");
}
-nsSVGDisplayContainerFrame*
-nsSVGUtils::GetNearestSVGViewport(nsIFrame *aFrame)
+nsIFrame*
+nsSVGUtils::GetNearestSVGParent(nsIFrame *aFrame)
{
NS_ASSERTION(aFrame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
- if (aFrame->GetType() == nsGkAtoms::svgOuterSVGFrame) {
- return nullptr;
- }
- while ((aFrame = aFrame->GetParent())) {
+
+ for (; aFrame && aFrame->IsFrameOfType(nsIFrame::eSVG);
+ aFrame = aFrame->GetParent()) {
NS_ASSERTION(aFrame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
if (aFrame->GetType() == nsGkAtoms::svgInnerSVGFrame ||
aFrame->GetType() == nsGkAtoms::svgOuterSVGFrame) {
- return do_QueryFrame(aFrame);
+ return aFrame;
}
}
- NS_NOTREACHED("This is not reached. It's only needed to compile.");
+
return nullptr;
}
nsRect
nsSVGUtils::GetPostFilterVisualOverflowRect(nsIFrame *aFrame,
const nsRect &aPreFilterRect)
{
MOZ_ASSERT(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT,
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -191,20 +191,19 @@ public:
typedef mozilla::image::DrawResult DrawResult;
static void Init();
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ObjectBoundingBoxProperty, gfxRect)
/**
* Gets the nearest nsSVGInnerSVGFrame or nsSVGOuterSVGFrame frame. aFrame
- * must be an SVG frame. If aFrame is of type nsGkAtoms::svgOuterSVGFrame,
- * returns nullptr.
+ * must be an SVG frame.
*/
- static nsSVGDisplayContainerFrame* GetNearestSVGViewport(nsIFrame *aFrame);
+ static nsIFrame* GetNearestSVGParent(nsIFrame *aFrame);
/**
* Returns the frame's post-filter visual overflow rect when passed the
* frame's pre-filter visual overflow rect. If the frame is not currently
* being filtered, this function simply returns aUnfilteredRect.
*/
static nsRect GetPostFilterVisualOverflowRect(nsIFrame *aFrame,
const nsRect &aUnfilteredRect);