From 0f97ab91f47bc11ca540a6e8e95b0fe896044ed4 Mon Sep 17 00:00:00 2001 From: "jwatt@jwatt.org" Date: Sun, 22 Jul 2007 15:35:05 -0700 Subject: [PATCH] Fixing bug 381285. ASSERTION: can't mark frame dirty during reflow. r=dbaron@mozilla.com --- layout/svg/base/src/nsSVGForeignObjectFrame.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index c92034f3d8f..8c2d6d7c63f 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -512,6 +512,21 @@ void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType) if (!kid) return; + // If we're called while the PresShell is handling reflow events we must do + // the reflow synchronously here and now. Calling FrameNeedsReflow could + // confuse the PresShell and prevent us from being reflowed correctly in + // future. + PRBool reflowing; + PresContext()->PresShell()->IsReflowLocked(&reflowing); + if (reflowing) { + NS_ASSERTION(aType == nsIPresShell::eResize, "Failed to invalidate stored intrinsic widths!"); + // only refow here and now if we the PresShell isn't already planning to + if (!(kid->GetStateBits() & NS_FRAME_IS_DIRTY)) { + DoReflow(); + } + return; + } + PresContext()->PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY); }