diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index 41158c8deeb2..ffa5697b695e 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_BODY_NO_AUTO_MARGINS); captionFrame->SetStyleContext(aPresContext, childStyleContext); - // Process the caption's child content and initialize it + // Process the caption's child content and set the initial child list nsIFrame* captionChildList; ProcessChildren(aPresContext, captionFrame, childContent, captionChildList); - captionFrame->Init(*aPresContext, captionChildList); + captionFrame->SetInitialChildList(*aPresContext, nsnull, captionChildList); // Prepend the caption frame to the outer frame's child list innerFrame->SetNextSibling(captionFrame); @@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, if (nsnull != frame) { frame->SetStyleContext(aPresContext, childStyleContext); - // Process the children, and initialize the frame + // Process the children, and set the frame's initial child list nsIFrame* childChildList; ProcessChildren(aPresContext, frame, childContent, childChildList); - frame->Init(*aPresContext, childChildList); + frame->SetInitialChildList(*aPresContext, nsnull, childChildList); // Link the frame into the child list if (nsnull == lastChildFrame) { @@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, } } - // Initialize the inner table with its child list - innerFrame->Init(*aPresContext, innerChildList); + // Set the inner table frame's list of initial child frames + innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList); - // Initialize the anonymous table outer frame - aNewFrame->Init(*aPresContext, childList); + // Set the anonymous table outer frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); return NS_OK; } @@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); - // Process the child content, and initialize the page sequence frame + // Process the child content, and set the page sequence frame's initial + // child list rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->Init(*aPresContext, childList); + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); // Set the root frame's initial child list - aNewFrame->Init(*aPresContext, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); } } } else { nsIFrame* childList; - // Process the child content, and initialize the frame + // Process the child content, and set the frame's initial child list rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - aNewFrame->Init(*aPresContext, childList); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } } } @@ -1214,8 +1215,8 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, aStyleContext, aNewFrame); // Note: table construction function takes care of setting the style context, - // processing children, and calling Init() + // processing children, and setting the initial child list return rv; case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: @@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, // Set the scroll frame's initial child list and return the scroll frame // as the frame sub-tree if (nsnull != scrollFrame) { - scrollFrame->Init(*aPresContext, aFrameSubTree); + scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree); aFrameSubTree = scrollFrame; } } diff --git a/layout/base/public/nsIFrame.h b/layout/base/public/nsIFrame.h index ec230adacd6e..a260b158064d 100644 --- a/layout/base/public/nsIFrame.h +++ b/layout/base/public/nsIFrame.h @@ -125,18 +125,24 @@ class nsIFrame : public nsISupports { public: /** - * Initialize the frame passing it its child frame list. + * Called to set the initial list of frames. This happens after the frame + * has been initialized and had its style context set. * - * This member function is called for all frames just after the frame is - * constructed. + * This is only called once for a given child list, and won't be called + * at all for child lists with no initial list of frames. * - * You should reflow the frames when you get your 'initial' reflow - * notification. - * - * @param aChildList list of child frames. May be NULL - * @see #Reflow() + * @param aListName the name of the child list. A NULL pointer for the atom + * name means the unnamed principal child list + * @param aChildList list of child frames + * @return NS_ERROR_INVALID_ARG if there is no child list with the specified + * name, + * NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the + * initial list of frames has already been set for that child list, + * NS_OK otherwise */ - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList) = 0; + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) = 0; /** * Add this object's size information to the sizeof handler. Note that diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index da1ddcdc79ed..355398f3695b 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -59,7 +59,9 @@ public: nsFieldSetFrame(nsIContent* aContent, nsIFrame* aParentFrame); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -115,7 +117,9 @@ nsFieldSetFrame::~nsFieldSetFrame() } NS_IMETHODIMP -nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // cache our display type const nsStyleDisplay* styleDisplay; @@ -163,7 +167,7 @@ nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the content frame - return mFirstChild->Init(aPresContext, newChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, newChildList); } // this is identical to nsHTMLContainerFrame::Paint except for the background and border. diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index 1ac02a57fc3b..3f4ca951cc21 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -207,7 +207,9 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsFormControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); diff --git a/layout/forms/nsFormControlFrame.h b/layout/forms/nsFormControlFrame.h index 49084ffcd137..d984409fb30b 100644 --- a/layout/forms/nsFormControlFrame.h +++ b/layout/forms/nsFormControlFrame.h @@ -111,7 +111,9 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 84a1056ef248..1b392b1fe6ab 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -79,7 +79,9 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); NS_IMETHOD GetType(PRInt32* aType) const; @@ -525,7 +527,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); @@ -577,7 +581,7 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLis } // Queue up the frames for the inline frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_IMETHODIMP diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp index 5f6905d20111..bb3d6b3ddcd3 100644 --- a/layout/forms/nsImageControlFrame.cpp +++ b/layout/forms/nsImageControlFrame.cpp @@ -62,7 +62,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, @@ -155,7 +157,9 @@ nsrefcnt nsImageControlFrame::Release(void) } NS_IMETHODIMP -nsImageControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsFormFrame::AddFormControlFrame(aPresContext, *this); if (nsnull == mFormFrame) { diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index af375929443b..40d778e75300 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -87,7 +87,9 @@ nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // cache our display type const nsStyleDisplay* styleDisplay; @@ -110,7 +112,7 @@ nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the inline frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_IMETHODIMP diff --git a/layout/forms/nsLegendFrame.h b/layout/forms/nsLegendFrame.h index cc78ffe45465..9f7d5d797e06 100644 --- a/layout/forms/nsLegendFrame.h +++ b/layout/forms/nsLegendFrame.h @@ -37,7 +37,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 63fc2148da72..ab2c737ac07f 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -54,12 +54,23 @@ nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const } NS_IMETHODIMP -nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); + nsresult result; - mFirstChild = aChildList; - return NS_OK; + if (nsnull != mFirstChild) { + result = NS_ERROR_UNEXPECTED; + } else if (nsnull != aListName) { + result = NS_ERROR_INVALID_ARG; + } else { + mFirstChild = aChildList; + result = NS_OK; + } + + return result; } NS_IMETHODIMP diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index 1f1392ac57ff..079277daee0b 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -28,9 +28,11 @@ class nsContainerFrame : public nsSplittableFrame public: NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); - NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 919609da5fb2..09042022cade 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -294,14 +294,19 @@ nsrefcnt nsFrame::Release(void) ///////////////////////////////////////////////////////////////////////////// // nsIFrame -NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +NS_IMETHODIMP nsFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { - if (nsnull != aChildList) { - NS_ERROR("not a container"); - return NS_ERROR_UNEXPECTED; - } - + // XXX This shouldn't be getting called at all, but currently is for backwards + // compatility reasons... +#if 0 + NS_ERROR("not a container"); + return NS_ERROR_UNEXPECTED; +#else + NS_ASSERTION(nsnull == aChildList, "not a container"); return NS_OK; +#endif } NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 8dca9ba7db49..08ac9527aedd 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -112,7 +112,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD GetContent(nsIContent*& aContent) const; diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp index 7ea7ba2ed3fe..264e372c7d1c 100644 --- a/layout/generic/nsHTMLContainerFrame.cpp +++ b/layout/generic/nsHTMLContainerFrame.cpp @@ -231,7 +231,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext, NS_RELEASE(pseudoStyle); // Init the body frame - aWrapperFrame->Init(aPresContext, aFrame); + aWrapperFrame->SetInitialChildList(aPresContext, nsnull, aFrame); } NS_RELEASE(content); diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index acb7d9fcf3b3..813e816c603f 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -45,7 +45,9 @@ class RootFrame : public nsHTMLContainerFrame { public: RootFrame(nsIContent* aContent); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -82,30 +84,12 @@ RootFrame::RootFrame(nsIContent* aContent) } NS_IMETHODIMP -RootFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +RootFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { -#if 0 - // Construct the root content frame and set its style context - mFirstChild = new RootContentFrame(mContent, this); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::rootContentPseudo, - mStyleContext); - mFirstChild->SetStyleContext(&aPresContext, pseudoStyleContext); - NS_RELEASE(pseudoStyleContext); - - // Set the geometric and content parent for each of the child frames - for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(frame)) { - frame->SetGeometricParent(mFirstChild); - frame->SetContentParent(mFirstChild); - } - - // Queue up the frames for the root content frame - return mFirstChild->Init(aPresContext, aChildList); -#else mFirstChild = aChildList; return NS_OK; -#endif } NS_IMETHODIMP diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index ec230adacd6e..a260b158064d 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -125,18 +125,24 @@ class nsIFrame : public nsISupports { public: /** - * Initialize the frame passing it its child frame list. + * Called to set the initial list of frames. This happens after the frame + * has been initialized and had its style context set. * - * This member function is called for all frames just after the frame is - * constructed. + * This is only called once for a given child list, and won't be called + * at all for child lists with no initial list of frames. * - * You should reflow the frames when you get your 'initial' reflow - * notification. - * - * @param aChildList list of child frames. May be NULL - * @see #Reflow() + * @param aListName the name of the child list. A NULL pointer for the atom + * name means the unnamed principal child list + * @param aChildList list of child frames + * @return NS_ERROR_INVALID_ARG if there is no child list with the specified + * name, + * NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the + * initial list of frames has already been set for that child list, + * NS_OK otherwise */ - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList) = 0; + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) = 0; /** * Add this object's size information to the sizeof handler. Note that diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index f37dc740c937..40533d8e564c 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -60,7 +60,9 @@ public: virtual ~nsInlineFrame(); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX, nsIFrame* aParent, nsIStyleContext* aStyleContext, @@ -237,7 +239,9 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); nsresult rv = AppendNewFrames(aPresContext, aChildList); diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index 1bd561eab28e..6b339f87f310 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -30,7 +30,9 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsIContent* aContent, nsIFr } NS_IMETHODIMP -nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsSimplePageSequenceFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // Create a page frame and set its style context mFirstChild = new nsPageFrame(mContent, this); @@ -49,7 +51,7 @@ nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLi } // Queue up the frames for the page frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } // XXX Hack diff --git a/layout/generic/nsSimplePageSequence.h b/layout/generic/nsSimplePageSequence.h index 1a75d8efe2fd..3b25340734f9 100644 --- a/layout/generic/nsSimplePageSequence.h +++ b/layout/generic/nsSimplePageSequence.h @@ -25,7 +25,9 @@ class nsSimplePageSequenceFrame : public nsContainerFrame { public: nsSimplePageSequenceFrame(nsIContent* aContent, nsIFrame* aParent); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index 7e4b158e2bf5..7e32317569b2 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -259,7 +259,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aParentContext); NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; @@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv = AppendNewFrames(aPresContext, aChildList); if (NS_OK != rv) { diff --git a/layout/html/base/src/nsBodyFrame.cpp b/layout/html/base/src/nsBodyFrame.cpp index 3fefb18b7a4c..1013343c04d5 100644 --- a/layout/html/base/src/nsBodyFrame.cpp +++ b/layout/html/base/src/nsBodyFrame.cpp @@ -88,7 +88,9 @@ nsBodyFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) // nsIFrame NS_IMETHODIMP -nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsBodyFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { if (nsnull == mPrevInFlow) { // Create a block frame and set its style context @@ -109,7 +111,7 @@ nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the block frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } else { // We have a prev-in-flow, so create a continuing block frame @@ -120,7 +122,7 @@ nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) prevBodyFrame->mFirstChild->CreateContinuingFrame(aPresContext, this, blockStyleContext, mFirstChild); NS_RELEASE(blockStyleContext); - return mFirstChild->Init(aPresContext, nsnull); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, nsnull); } } @@ -491,7 +493,7 @@ nsBodyFrame::CreateContinuingFrame(nsIPresContext& aPresContext, return NS_ERROR_OUT_OF_MEMORY; } PrepareContinuingFrame(aPresContext, aParent, aStyleContext, cf); - cf->Init(aPresContext, nsnull); + cf->SetInitialChildList(aPresContext, nsnull, nsnull); aContinuingFrame = cf; return NS_OK; } diff --git a/layout/html/base/src/nsBodyFrame.h b/layout/html/base/src/nsBodyFrame.h index 0c8867c97e98..9ed732139a89 100644 --- a/layout/html/base/src/nsBodyFrame.h +++ b/layout/html/base/src/nsBodyFrame.h @@ -37,7 +37,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index 63fc2148da72..ab2c737ac07f 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -54,12 +54,23 @@ nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const } NS_IMETHODIMP -nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); + nsresult result; - mFirstChild = aChildList; - return NS_OK; + if (nsnull != mFirstChild) { + result = NS_ERROR_UNEXPECTED; + } else if (nsnull != aListName) { + result = NS_ERROR_INVALID_ARG; + } else { + mFirstChild = aChildList; + result = NS_OK; + } + + return result; } NS_IMETHODIMP diff --git a/layout/html/base/src/nsContainerFrame.h b/layout/html/base/src/nsContainerFrame.h index 1f1392ac57ff..079277daee0b 100644 --- a/layout/html/base/src/nsContainerFrame.h +++ b/layout/html/base/src/nsContainerFrame.h @@ -28,9 +28,11 @@ class nsContainerFrame : public nsSplittableFrame public: NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); - NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index 919609da5fb2..09042022cade 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -294,14 +294,19 @@ nsrefcnt nsFrame::Release(void) ///////////////////////////////////////////////////////////////////////////// // nsIFrame -NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +NS_IMETHODIMP nsFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { - if (nsnull != aChildList) { - NS_ERROR("not a container"); - return NS_ERROR_UNEXPECTED; - } - + // XXX This shouldn't be getting called at all, but currently is for backwards + // compatility reasons... +#if 0 + NS_ERROR("not a container"); + return NS_ERROR_UNEXPECTED; +#else + NS_ASSERTION(nsnull == aChildList, "not a container"); return NS_OK; +#endif } NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) diff --git a/layout/html/base/src/nsFrame.h b/layout/html/base/src/nsFrame.h index 8dca9ba7db49..08ac9527aedd 100644 --- a/layout/html/base/src/nsFrame.h +++ b/layout/html/base/src/nsFrame.h @@ -112,7 +112,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD GetContent(nsIContent*& aContent) const; diff --git a/layout/html/base/src/nsHTMLContainerFrame.cpp b/layout/html/base/src/nsHTMLContainerFrame.cpp index 7ea7ba2ed3fe..264e372c7d1c 100644 --- a/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -231,7 +231,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext, NS_RELEASE(pseudoStyle); // Init the body frame - aWrapperFrame->Init(aPresContext, aFrame); + aWrapperFrame->SetInitialChildList(aPresContext, nsnull, aFrame); } NS_RELEASE(content); diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp index acb7d9fcf3b3..813e816c603f 100644 --- a/layout/html/base/src/nsHTMLFrame.cpp +++ b/layout/html/base/src/nsHTMLFrame.cpp @@ -45,7 +45,9 @@ class RootFrame : public nsHTMLContainerFrame { public: RootFrame(nsIContent* aContent); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, @@ -82,30 +84,12 @@ RootFrame::RootFrame(nsIContent* aContent) } NS_IMETHODIMP -RootFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +RootFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { -#if 0 - // Construct the root content frame and set its style context - mFirstChild = new RootContentFrame(mContent, this); - nsIStyleContext* pseudoStyleContext = - aPresContext.ResolvePseudoStyleContextFor(mContent, - nsHTMLAtoms::rootContentPseudo, - mStyleContext); - mFirstChild->SetStyleContext(&aPresContext, pseudoStyleContext); - NS_RELEASE(pseudoStyleContext); - - // Set the geometric and content parent for each of the child frames - for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(frame)) { - frame->SetGeometricParent(mFirstChild); - frame->SetContentParent(mFirstChild); - } - - // Queue up the frames for the root content frame - return mFirstChild->Init(aPresContext, aChildList); -#else mFirstChild = aChildList; return NS_OK; -#endif } NS_IMETHODIMP diff --git a/layout/html/base/src/nsInlineFrame.cpp b/layout/html/base/src/nsInlineFrame.cpp index f37dc740c937..40533d8e564c 100644 --- a/layout/html/base/src/nsInlineFrame.cpp +++ b/layout/html/base/src/nsInlineFrame.cpp @@ -60,7 +60,9 @@ public: virtual ~nsInlineFrame(); // nsIFrame - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX, nsIFrame* aParent, nsIStyleContext* aStyleContext, @@ -237,7 +239,9 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); nsresult rv = AppendNewFrames(aPresContext, aChildList); diff --git a/layout/html/base/src/nsScrollFrame.cpp b/layout/html/base/src/nsScrollFrame.cpp index 90713f5467d2..80ca4e408e19 100644 --- a/layout/html/base/src/nsScrollFrame.cpp +++ b/layout/html/base/src/nsScrollFrame.cpp @@ -48,7 +48,9 @@ class nsScrollFrame : public nsHTMLContainerFrame { public: nsScrollFrame(nsIContent* aContent, nsIFrame* aParent); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); @@ -77,7 +79,9 @@ nsScrollFrame::nsScrollFrame(nsIContent* aContent, nsIFrame* aParent) } NS_IMETHODIMP -nsScrollFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsScrollFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { NS_PRECONDITION(nsnull != aChildList, "no child frame"); NS_PRECONDITION(LengthOf(aChildList) == 1, "wrong number child frames"); diff --git a/layout/html/base/src/nsSimplePageSequence.cpp b/layout/html/base/src/nsSimplePageSequence.cpp index 1bd561eab28e..6b339f87f310 100644 --- a/layout/html/base/src/nsSimplePageSequence.cpp +++ b/layout/html/base/src/nsSimplePageSequence.cpp @@ -30,7 +30,9 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsIContent* aContent, nsIFr } NS_IMETHODIMP -nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsSimplePageSequenceFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // Create a page frame and set its style context mFirstChild = new nsPageFrame(mContent, this); @@ -49,7 +51,7 @@ nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLi } // Queue up the frames for the page frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } // XXX Hack diff --git a/layout/html/base/src/nsSimplePageSequence.h b/layout/html/base/src/nsSimplePageSequence.h index 1a75d8efe2fd..3b25340734f9 100644 --- a/layout/html/base/src/nsSimplePageSequence.h +++ b/layout/html/base/src/nsSimplePageSequence.h @@ -25,7 +25,9 @@ class nsSimplePageSequenceFrame : public nsContainerFrame { public: nsSimplePageSequenceFrame(nsIContent* aContent, nsIFrame* aParent); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/forms/src/nsFieldSetFrame.cpp b/layout/html/forms/src/nsFieldSetFrame.cpp index da1ddcdc79ed..355398f3695b 100644 --- a/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/layout/html/forms/src/nsFieldSetFrame.cpp @@ -59,7 +59,9 @@ public: nsFieldSetFrame(nsIContent* aContent, nsIFrame* aParentFrame); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -115,7 +117,9 @@ nsFieldSetFrame::~nsFieldSetFrame() } NS_IMETHODIMP -nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // cache our display type const nsStyleDisplay* styleDisplay; @@ -163,7 +167,7 @@ nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the content frame - return mFirstChild->Init(aPresContext, newChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, newChildList); } // this is identical to nsHTMLContainerFrame::Paint except for the background and border. diff --git a/layout/html/forms/src/nsFormControlFrame.cpp b/layout/html/forms/src/nsFormControlFrame.cpp index 1ac02a57fc3b..3f4ca951cc21 100644 --- a/layout/html/forms/src/nsFormControlFrame.cpp +++ b/layout/html/forms/src/nsFormControlFrame.cpp @@ -207,7 +207,9 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsFormControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); diff --git a/layout/html/forms/src/nsFormControlFrame.h b/layout/html/forms/src/nsFormControlFrame.h index 49084ffcd137..d984409fb30b 100644 --- a/layout/html/forms/src/nsFormControlFrame.h +++ b/layout/html/forms/src/nsFormControlFrame.h @@ -111,7 +111,9 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); diff --git a/layout/html/forms/src/nsFormFrame.cpp b/layout/html/forms/src/nsFormFrame.cpp index 3f733c7a6365..0c72eeaf9c35 100644 --- a/layout/html/forms/src/nsFormFrame.cpp +++ b/layout/html/forms/src/nsFormFrame.cpp @@ -207,7 +207,9 @@ nsFormFrame::GetEnctype(PRInt32* aEnctype) } NS_IMETHODIMP -nsFormFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsFormFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult result = NS_OK; nsIDOMHTMLFormElement* content = nsnull; diff --git a/layout/html/forms/src/nsFormFrame.h b/layout/html/forms/src/nsFormFrame.h index ef1c792d413d..58f2e3babfcc 100644 --- a/layout/html/forms/src/nsFormFrame.h +++ b/layout/html/forms/src/nsFormFrame.h @@ -79,7 +79,9 @@ class nsFormFrame : public nsLeafFrame, public: nsFormFrame(nsIContent* aContent, nsIFrame* aParentFrame); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 84a1056ef248..1b392b1fe6ab 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -79,7 +79,9 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); NS_IMETHOD GetType(PRInt32* aType) const; @@ -525,7 +527,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); @@ -577,7 +581,7 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLis } // Queue up the frames for the inline frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_IMETHODIMP diff --git a/layout/html/forms/src/nsImageControlFrame.cpp b/layout/html/forms/src/nsImageControlFrame.cpp index 5f6905d20111..bb3d6b3ddcd3 100644 --- a/layout/html/forms/src/nsImageControlFrame.cpp +++ b/layout/html/forms/src/nsImageControlFrame.cpp @@ -62,7 +62,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, @@ -155,7 +157,9 @@ nsrefcnt nsImageControlFrame::Release(void) } NS_IMETHODIMP -nsImageControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsFormFrame::AddFormControlFrame(aPresContext, *this); if (nsnull == mFormFrame) { diff --git a/layout/html/forms/src/nsLabelFrame.cpp b/layout/html/forms/src/nsLabelFrame.cpp index 329feaec7f59..5e5a3c877112 100644 --- a/layout/html/forms/src/nsLabelFrame.cpp +++ b/layout/html/forms/src/nsLabelFrame.cpp @@ -73,7 +73,9 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -394,7 +396,9 @@ nsLabelFrame::FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aRe NS_IMETHODIMP -nsLabelFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsLabelFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // create our view, we need a view to grab the mouse nsIView* view; @@ -439,7 +443,7 @@ nsLabelFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the body frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_IMETHODIMP diff --git a/layout/html/forms/src/nsLegendFrame.cpp b/layout/html/forms/src/nsLegendFrame.cpp index af375929443b..40d778e75300 100644 --- a/layout/html/forms/src/nsLegendFrame.cpp +++ b/layout/html/forms/src/nsLegendFrame.cpp @@ -87,7 +87,9 @@ nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_IMETHODIMP -nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // cache our display type const nsStyleDisplay* styleDisplay; @@ -110,7 +112,7 @@ nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the inline frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_IMETHODIMP diff --git a/layout/html/forms/src/nsLegendFrame.h b/layout/html/forms/src/nsLegendFrame.h index cc78ffe45465..9f7d5d797e06 100644 --- a/layout/html/forms/src/nsLegendFrame.h +++ b/layout/html/forms/src/nsLegendFrame.h @@ -37,7 +37,9 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/layout/html/style/src/nsHTMLStyleSheet.cpp b/layout/html/style/src/nsHTMLStyleSheet.cpp index 41158c8deeb2..ffa5697b695e 100644 --- a/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_BODY_NO_AUTO_MARGINS); captionFrame->SetStyleContext(aPresContext, childStyleContext); - // Process the caption's child content and initialize it + // Process the caption's child content and set the initial child list nsIFrame* captionChildList; ProcessChildren(aPresContext, captionFrame, childContent, captionChildList); - captionFrame->Init(*aPresContext, captionChildList); + captionFrame->SetInitialChildList(*aPresContext, nsnull, captionChildList); // Prepend the caption frame to the outer frame's child list innerFrame->SetNextSibling(captionFrame); @@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, if (nsnull != frame) { frame->SetStyleContext(aPresContext, childStyleContext); - // Process the children, and initialize the frame + // Process the children, and set the frame's initial child list nsIFrame* childChildList; ProcessChildren(aPresContext, frame, childContent, childChildList); - frame->Init(*aPresContext, childChildList); + frame->SetInitialChildList(*aPresContext, nsnull, childChildList); // Link the frame into the child list if (nsnull == lastChildFrame) { @@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, } } - // Initialize the inner table with its child list - innerFrame->Init(*aPresContext, innerChildList); + // Set the inner table frame's list of initial child frames + innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList); - // Initialize the anonymous table outer frame - aNewFrame->Init(*aPresContext, childList); + // Set the anonymous table outer frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); return NS_OK; } @@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); - // Process the child content, and initialize the page sequence frame + // Process the child content, and set the page sequence frame's initial + // child list rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->Init(*aPresContext, childList); + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); // Set the root frame's initial child list - aNewFrame->Init(*aPresContext, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); } } } else { nsIFrame* childList; - // Process the child content, and initialize the frame + // Process the child content, and set the frame's initial child list rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - aNewFrame->Init(*aPresContext, childList); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } } } @@ -1214,8 +1215,8 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, aStyleContext, aNewFrame); // Note: table construction function takes care of setting the style context, - // processing children, and calling Init() + // processing children, and setting the initial child list return rv; case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: @@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, // Set the scroll frame's initial child list and return the scroll frame // as the frame sub-tree if (nsnull != scrollFrame) { - scrollFrame->Init(*aPresContext, aFrameSubTree); + scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree); aFrameSubTree = scrollFrame; } } diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index 67cff23ba7db..d81bbb49e1bb 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -70,7 +70,9 @@ nsTableCellFrame::~nsTableCellFrame() } NS_IMETHODIMP -nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableCellFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // Create body pseudo frame NS_NewBodyFrame(mContent, this, mFirstChild, NS_BODY_NO_AUTO_MARGINS); @@ -88,7 +90,7 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the block frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, diff --git a/layout/html/table/src/nsTableCellFrame.h b/layout/html/table/src/nsTableCellFrame.h index f95afa9ec969..d5165901e6b4 100644 --- a/layout/html/table/src/nsTableCellFrame.h +++ b/layout/html/table/src/nsTableCellFrame.h @@ -53,7 +53,9 @@ public: // nsISupports NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/html/table/src/nsTableColGroupFrame.cpp b/layout/html/table/src/nsTableColGroupFrame.cpp index 3afd1e782cd5..232324fcdeda 100644 --- a/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/layout/html/table/src/nsTableColGroupFrame.cpp @@ -108,7 +108,7 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi nsIStyleContextPtr colStyleContext = aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); colFrame->SetStyleContext(&aPresContext, colStyleContext); - colFrame->Init(aPresContext, nsnull); + colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); // Set nsColFrame-specific information PRInt32 absColIndex = mStartColIndex + colIndex; @@ -159,7 +159,9 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC } NS_IMETHODIMP -nsTableColGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult result = AppendNewFrames(aPresContext, aChildList); if (NS_OK==result) diff --git a/layout/html/table/src/nsTableColGroupFrame.h b/layout/html/table/src/nsTableColGroupFrame.h index 8142dd81d514..3a999187ec0b 100644 --- a/layout/html/table/src/nsTableColGroupFrame.h +++ b/layout/html/table/src/nsTableColGroupFrame.h @@ -45,7 +45,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index fa0001a9da48..ad343f0daf51 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -300,7 +300,9 @@ nsTableFrame::~nsTableFrame() } NS_IMETHODIMP -nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv=NS_OK; mFirstChild = aChildList; @@ -740,7 +742,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) nsIStyleContextPtr colStyleContext = aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE); colFrame->SetStyleContext(&aPresContext, colStyleContext); - colFrame->Init(aPresContext, nsnull); + colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); // XXX Don't release this style context (or we'll end up with a double-free).\ // This code is doing what nsTableColGroupFrame::Reflow() does... @@ -755,7 +757,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) lastNewColFrame = colFrame; NS_RELEASE(col); // ADDREF: col-- } - lastColGroupFrame->Init(aPresContext, firstNewColFrame); + lastColGroupFrame->SetInitialChildList(aPresContext, nsnull, firstNewColFrame); NS_RELEASE(lastColGroup); // ADDREF: lastColGroup-- } } diff --git a/layout/html/table/src/nsTableFrame.h b/layout/html/table/src/nsTableFrame.h index c72cfe96e53b..c2cc7233f0ae 100644 --- a/layout/html/table/src/nsTableFrame.h +++ b/layout/html/table/src/nsTableFrame.h @@ -92,7 +92,9 @@ public: */ PRBool IsRowGroup(PRInt32 aDisplayType); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** complete the append of aRowGroupFrame to the table * this builds the cell map diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 39a0236c45cb..c0316715c83e 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -105,7 +105,9 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram { } -NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; diff --git a/layout/html/table/src/nsTableOuterFrame.h b/layout/html/table/src/nsTableOuterFrame.h index b49e7285ddbb..94fbbe1c75da 100644 --- a/layout/html/table/src/nsTableOuterFrame.h +++ b/layout/html/table/src/nsTableOuterFrame.h @@ -50,7 +50,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/html/table/src/nsTableRowFrame.cpp b/layout/html/table/src/nsTableRowFrame.cpp index 34f5080d11e2..59d28573d6cd 100644 --- a/layout/html/table/src/nsTableRowFrame.cpp +++ b/layout/html/table/src/nsTableRowFrame.cpp @@ -98,7 +98,9 @@ nsTableRowFrame::~nsTableRowFrame() } NS_IMETHODIMP -nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableRowFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; return NS_OK; diff --git a/layout/html/table/src/nsTableRowFrame.h b/layout/html/table/src/nsTableRowFrame.h index 707a21c9bffe..3d50a3d48387 100644 --- a/layout/html/table/src/nsTableRowFrame.h +++ b/layout/html/table/src/nsTableRowFrame.h @@ -58,7 +58,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/html/table/src/nsTableRowGroupFrame.cpp b/layout/html/table/src/nsTableRowGroupFrame.cpp index 22c06a2bdd0e..470ab0bcb098 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -155,7 +155,9 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const NS_IMETHODIMP -nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; return NS_OK; diff --git a/layout/html/table/src/nsTableRowGroupFrame.h b/layout/html/table/src/nsTableRowGroupFrame.h index ced1854afc75..2456c8afc1c0 100644 --- a/layout/html/table/src/nsTableRowGroupFrame.h +++ b/layout/html/table/src/nsTableRowGroupFrame.h @@ -52,7 +52,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 41158c8deeb2..ffa5697b695e 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_BODY_NO_AUTO_MARGINS); captionFrame->SetStyleContext(aPresContext, childStyleContext); - // Process the caption's child content and initialize it + // Process the caption's child content and set the initial child list nsIFrame* captionChildList; ProcessChildren(aPresContext, captionFrame, childContent, captionChildList); - captionFrame->Init(*aPresContext, captionChildList); + captionFrame->SetInitialChildList(*aPresContext, nsnull, captionChildList); // Prepend the caption frame to the outer frame's child list innerFrame->SetNextSibling(captionFrame); @@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, if (nsnull != frame) { frame->SetStyleContext(aPresContext, childStyleContext); - // Process the children, and initialize the frame + // Process the children, and set the frame's initial child list nsIFrame* childChildList; ProcessChildren(aPresContext, frame, childContent, childChildList); - frame->Init(*aPresContext, childChildList); + frame->SetInitialChildList(*aPresContext, nsnull, childChildList); // Link the frame into the child list if (nsnull == lastChildFrame) { @@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext, } } - // Initialize the inner table with its child list - innerFrame->Init(*aPresContext, innerChildList); + // Set the inner table frame's list of initial child frames + innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList); - // Initialize the anonymous table outer frame - aNewFrame->Init(*aPresContext, childList); + // Set the anonymous table outer frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); return NS_OK; } @@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext, pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); - // Process the child content, and initialize the page sequence frame + // Process the child content, and set the page sequence frame's initial + // child list rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - pageSequenceFrame->Init(*aPresContext, childList); + pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList); // Set the root frame's initial child list - aNewFrame->Init(*aPresContext, pageSequenceFrame); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame); } } } else { nsIFrame* childList; - // Process the child content, and initialize the frame + // Process the child content, and set the frame's initial child list rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); if (NS_SUCCEEDED(rv)) { - aNewFrame->Init(*aPresContext, childList); + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } } } @@ -1214,8 +1215,8 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, aStyleContext, aNewFrame); // Note: table construction function takes care of setting the style context, - // processing children, and calling Init() + // processing children, and setting the initial child list return rv; case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: @@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext, rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); } - // Initialize the frame - aNewFrame->Init(*aPresContext, childList); + // Set the frame's initial child list + aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList); } return rv; @@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, // Set the scroll frame's initial child list and return the scroll frame // as the frame sub-tree if (nsnull != scrollFrame) { - scrollFrame->Init(*aPresContext, aFrameSubTree); + scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree); aFrameSubTree = scrollFrame; } } diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 67cff23ba7db..d81bbb49e1bb 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -70,7 +70,9 @@ nsTableCellFrame::~nsTableCellFrame() } NS_IMETHODIMP -nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableCellFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { // Create body pseudo frame NS_NewBodyFrame(mContent, this, mFirstChild, NS_BODY_NO_AUTO_MARGINS); @@ -88,7 +90,7 @@ nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) } // Queue up the frames for the block frame - return mFirstChild->Init(aPresContext, aChildList); + return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList); } NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index f95afa9ec969..d5165901e6b4 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -53,7 +53,9 @@ public: // nsISupports NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index 3afd1e782cd5..232324fcdeda 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -108,7 +108,7 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi nsIStyleContextPtr colStyleContext = aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); colFrame->SetStyleContext(&aPresContext, colStyleContext); - colFrame->Init(aPresContext, nsnull); + colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); // Set nsColFrame-specific information PRInt32 absColIndex = mStartColIndex + colIndex; @@ -159,7 +159,9 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC } NS_IMETHODIMP -nsTableColGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult result = AppendNewFrames(aPresContext, aChildList); if (NS_OK==result) diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index 8142dd81d514..3a999187ec0b 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -45,7 +45,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index fa0001a9da48..ad343f0daf51 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -300,7 +300,9 @@ nsTableFrame::~nsTableFrame() } NS_IMETHODIMP -nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { nsresult rv=NS_OK; mFirstChild = aChildList; @@ -740,7 +742,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) nsIStyleContextPtr colStyleContext = aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE); colFrame->SetStyleContext(&aPresContext, colStyleContext); - colFrame->Init(aPresContext, nsnull); + colFrame->SetInitialChildList(aPresContext, nsnull, nsnull); // XXX Don't release this style context (or we'll end up with a double-free).\ // This code is doing what nsTableColGroupFrame::Reflow() does... @@ -755,7 +757,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext) lastNewColFrame = colFrame; NS_RELEASE(col); // ADDREF: col-- } - lastColGroupFrame->Init(aPresContext, firstNewColFrame); + lastColGroupFrame->SetInitialChildList(aPresContext, nsnull, firstNewColFrame); NS_RELEASE(lastColGroup); // ADDREF: lastColGroup-- } } diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index c72cfe96e53b..c2cc7233f0ae 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -92,7 +92,9 @@ public: */ PRBool IsRowGroup(PRInt32 aDisplayType); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** complete the append of aRowGroupFrame to the table * this builds the cell map diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 39a0236c45cb..c0316715c83e 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -105,7 +105,9 @@ nsTableOuterFrame::nsTableOuterFrame(nsIContent* aContent, nsIFrame* aParentFram { } -NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index b49e7285ddbb..94fbbe1c75da 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -50,7 +50,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 34f5080d11e2..59d28573d6cd 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -98,7 +98,9 @@ nsTableRowFrame::~nsTableRowFrame() } NS_IMETHODIMP -nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableRowFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; return NS_OK; diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 707a21c9bffe..3d50a3d48387 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -58,7 +58,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext, diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 22c06a2bdd0e..470ab0bcb098 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -155,7 +155,9 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const NS_IMETHODIMP -nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) +nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList) { mFirstChild = aChildList; return NS_OK; diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index ced1854afc75..2456c8afc1c0 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -52,7 +52,9 @@ public: nsIFrame* aParentFrame, nsIFrame*& aResult); - NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); + NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, + nsIAtom* aListName, + nsIFrame* aChildList); /** @see nsIFrame::Paint */ NS_IMETHOD Paint(nsIPresContext& aPresContext,