From c8def8cd3c331cb52430898ad3cec5d8a349645a Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 3 Aug 2001 07:15:06 +0000 Subject: [PATCH] Bug 70258. A XUL document has a different root frame hierarchy than an HTML document, and |ReconstructDocElementHierarchy()| needs to deal. Specifically, for a XUL document, it must remove the GfxScroll from the RootBoxFrame; in an HTML document, it must remove the Area from the Canvas frame. r=bryner, sr=hyatt. git-svn-id: svn://10.0.0.236/trunk@100278 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 25 +++++++++++++++++++ .../html/style/src/nsCSSFrameConstructor.cpp | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 3f191f43ac0..440f4af590c 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -86,6 +86,7 @@ #include "nsFormControlHelper.h" #include "nsObjectFrame.h" #include "nsIRuleNode.h" +#include "nsIXULDocument.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -7406,6 +7407,23 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte state.mFrameManager->ClearPlaceholderFrameMap(); state.mFrameManager->ClearUndisplayedContentMap(); + // If we're in a XUL document, then we need to crawl up to the + // RootBoxFrame and remove _its_ child. + if (docElementFrame) { + nsCOMPtr xuldoc = do_QueryInterface(mDocument); + if (xuldoc) { + docElementFrame->GetParent(&docElementFrame); + NS_ASSERTION(docElementFrame, "expected to find a ScrollBoxFrame"); + if (docElementFrame) { + docElementFrame->GetParent(&docElementFrame); + NS_ASSERTION(docElementFrame, "expected to find a GfxScroll"); + } + } + } + + // Take the docElementFrame, and remove it from its parent. For + // HTML, we'll be removing the Area frame from the Canvas; for + // XUL, we'll remove the GfxScroll frome the RootBoxFrame. if (docElementFrame) { nsIFrame* docParentFrame; docElementFrame->GetParent(&docParentFrame); @@ -9625,6 +9643,13 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIAtom* aAttribute) { + // If the frame hasn't even received an initial reflow, then don't + // send it a style-change reflow! + nsFrameState state; + aFrame->GetFrameState(&state); + if (state & NS_FRAME_FIRST_REFLOW) + return NS_OK; + #ifdef DEBUG if (gNoisyContentUpdates) { printf("nsCSSFrameConstructor::StyleChangeReflow: aFrame="); diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 3f191f43ac0..440f4af590c 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -86,6 +86,7 @@ #include "nsFormControlHelper.h" #include "nsObjectFrame.h" #include "nsIRuleNode.h" +#include "nsIXULDocument.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -7406,6 +7407,23 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte state.mFrameManager->ClearPlaceholderFrameMap(); state.mFrameManager->ClearUndisplayedContentMap(); + // If we're in a XUL document, then we need to crawl up to the + // RootBoxFrame and remove _its_ child. + if (docElementFrame) { + nsCOMPtr xuldoc = do_QueryInterface(mDocument); + if (xuldoc) { + docElementFrame->GetParent(&docElementFrame); + NS_ASSERTION(docElementFrame, "expected to find a ScrollBoxFrame"); + if (docElementFrame) { + docElementFrame->GetParent(&docElementFrame); + NS_ASSERTION(docElementFrame, "expected to find a GfxScroll"); + } + } + } + + // Take the docElementFrame, and remove it from its parent. For + // HTML, we'll be removing the Area frame from the Canvas; for + // XUL, we'll remove the GfxScroll frome the RootBoxFrame. if (docElementFrame) { nsIFrame* docParentFrame; docElementFrame->GetParent(&docParentFrame); @@ -9625,6 +9643,13 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIAtom* aAttribute) { + // If the frame hasn't even received an initial reflow, then don't + // send it a style-change reflow! + nsFrameState state; + aFrame->GetFrameState(&state); + if (state & NS_FRAME_FIRST_REFLOW) + return NS_OK; + #ifdef DEBUG if (gNoisyContentUpdates) { printf("nsCSSFrameConstructor::StyleChangeReflow: aFrame=");