From d38f0b028dc975b8789cadadcdb0d428b6c6ee34 Mon Sep 17 00:00:00 2001 From: "kin%netscape.com" Date: Tue, 10 Sep 2002 04:36:00 +0000 Subject: [PATCH] Fix for bug 167355 (non-inline document.write does not work in builds after 090522) Clear the mDidInitialReflow flag in ContentRemoved() to allow the content sink to call InitialReflow() when the node is re-inserted. r=jkeiser@netscape.com sr=jst@netscape.com a=asa@mozilla.org --- layout/base/nsPresShell.cpp | 15 +++++++++++++++ layout/html/base/src/nsPresShell.cpp | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index b9ef78b8733e..b1c85bbdcdbc 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5314,6 +5314,21 @@ PresShell::ContentRemoved(nsIDocument *aDocument, WillCauseReflow(); nsresult rv = mStyleSet->ContentRemoved(mPresContext, aContainer, aChild, aIndexInContainer); + + // If we have no root content node at this point, be sure to reset + // mDidInitialReflow to PR_FALSE, this will allow InitialReflow() + // to be called again should a new root node be inserted for this + // presShell. (Bug 167355) + + if (mDocument) { + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); + + if (!rootContent) { + mDidInitialReflow = PR_FALSE; + } + } + VERIFY_STYLE_TREE; DidCauseReflow(); return rv; diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index b9ef78b8733e..b1c85bbdcdbc 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -5314,6 +5314,21 @@ PresShell::ContentRemoved(nsIDocument *aDocument, WillCauseReflow(); nsresult rv = mStyleSet->ContentRemoved(mPresContext, aContainer, aChild, aIndexInContainer); + + // If we have no root content node at this point, be sure to reset + // mDidInitialReflow to PR_FALSE, this will allow InitialReflow() + // to be called again should a new root node be inserted for this + // presShell. (Bug 167355) + + if (mDocument) { + nsCOMPtr rootContent; + mDocument->GetRootContent(getter_AddRefs(rootContent)); + + if (!rootContent) { + mDidInitialReflow = PR_FALSE; + } + } + VERIFY_STYLE_TREE; DidCauseReflow(); return rv;