diff --git a/layout/svg/base/src/nsISVGChildFrame.h b/layout/svg/base/src/nsISVGChildFrame.h index 0be28de9cce..0e01c82f6e2 100644 --- a/layout/svg/base/src/nsISVGChildFrame.h +++ b/layout/svg/base/src/nsISVGChildFrame.h @@ -76,7 +76,13 @@ public: NS_IMETHOD_(nsRect) GetCoveredRegion()=0; NS_IMETHOD UpdateCoveredRegion()=0; + + // Called once on all SVG child frames, either when their nsSVGOuterSVGFrame + // receives its initial reflow (i.e. once the SVG viewport dimensions are + // known), or else when they're inserted into the frame tree (if they're + // inserted after the initial reflow). NS_IMETHOD InitialUpdate()=0; + NS_IMETHOD NotifyCanvasTMChanged(PRBool suppressInvalidation)=0; NS_IMETHOD NotifyRedrawSuspended()=0; NS_IMETHOD NotifyRedrawUnsuspended()=0; diff --git a/layout/svg/base/src/nsSVGContainerFrame.cpp b/layout/svg/base/src/nsSVGContainerFrame.cpp index b1dcb8154e0..212e0a5f4b4 100644 --- a/layout/svg/base/src/nsSVGContainerFrame.cpp +++ b/layout/svg/base/src/nsSVGContainerFrame.cpp @@ -125,20 +125,23 @@ nsSVGDisplayContainerFrame::InsertFrames(nsIAtom* aListName, // Insert the new frames nsSVGContainerFrame::InsertFrames(aListName, aPrevFrame, aFrameList); - // call InitialUpdate() on all new frames: - nsIFrame* end = nsnull; - if (lastNewFrame) - end = lastNewFrame->GetNextSibling(); - - for (nsIFrame* kid = aFrameList; kid != end; - kid = kid->GetNextSibling()) { - nsISVGChildFrame* SVGFrame=nsnull; - CallQueryInterface(kid, &SVGFrame); - if (SVGFrame) { - SVGFrame->InitialUpdate(); + // Call InitialUpdate on the new frames ONLY if our nsSVGOuterSVGFrame has had + // its initial reflow (our NS_FRAME_FIRST_REFLOW bit is clear) - bug 399863. + if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) { + nsIFrame* end = nsnull; + if (lastNewFrame) + end = lastNewFrame->GetNextSibling(); + + for (nsIFrame* kid = aFrameList; kid != end; + kid = kid->GetNextSibling()) { + nsISVGChildFrame* SVGFrame = nsnull; + CallQueryInterface(kid, &SVGFrame); + if (SVGFrame) { + SVGFrame->InitialUpdate(); + } } } - + return NS_OK; } @@ -214,6 +217,10 @@ nsSVGDisplayContainerFrame::UpdateCoveredRegion() NS_IMETHODIMP nsSVGDisplayContainerFrame::InitialUpdate() { + NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW, + "Yikes! We've been called already! Hopefully we weren't called " + "before our nsSVGOuterSVGFrame's initial Reflow()!!!"); + for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = nsnull; diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index bb7d221836f..0b492914f6d 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -365,6 +365,10 @@ nsSVGForeignObjectFrame::UpdateCoveredRegion() NS_IMETHODIMP nsSVGForeignObjectFrame::InitialUpdate() { + NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW, + "Yikes! We've been called already! Hopefully we weren't called " + "before our nsSVGOuterSVGFrame's initial Reflow()!!!"); + UpdateCoveredRegion(); DoReflow(); @@ -585,6 +589,10 @@ nsSVGForeignObjectFrame::DoReflow() printf("**nsSVGForeignObjectFrame::DoReflow()\n"); #endif + NS_ASSERTION(!(nsSVGUtils::GetOuterSVGFrame(this)-> + GetStateBits() & NS_FRAME_FIRST_REFLOW), + "Calling InitialUpdate too early - must not call DoReflow!!!"); + if (IsDisabled()) return; diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 0ac8d7e75aa..3e9d1cd1e0b 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -461,6 +461,10 @@ nsSVGGlyphFrame::UpdateCoveredRegion() NS_IMETHODIMP nsSVGGlyphFrame::InitialUpdate() { + NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW, + "Yikes! We've been called already! Hopefully we weren't called " + "before our nsSVGOuterSVGFrame's initial Reflow()!!!"); + NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW), "We don't actually participate in reflow"); diff --git a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp index 1a39fdc0898..d651dbd4279 100644 --- a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp @@ -444,6 +444,10 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion() NS_IMETHODIMP nsSVGPathGeometryFrame::InitialUpdate() { + NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW, + "Yikes! We've been called already! Hopefully we weren't called " + "before our nsSVGOuterSVGFrame's initial Reflow()!!!"); + UpdateGraphic(); NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW),