Renamed Init() to SetInitialChildList() and added an additional parameter

for the name of the child list
This commit is contained in:
troy@netscape.com
1998-11-10 06:05:32 +00:00
parent 72851b4608
commit 7d57a590c9
73 changed files with 404 additions and 237 deletions

View File

@@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_NewBodyFrame(childContent, aNewFrame, captionFrame,
NS_BODY_NO_AUTO_MARGINS); NS_BODY_NO_AUTO_MARGINS);
captionFrame->SetStyleContext(aPresContext, childStyleContext); 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; nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, 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 // Prepend the caption frame to the outer frame's child list
innerFrame->SetNextSibling(captionFrame); innerFrame->SetNextSibling(captionFrame);
@@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull != frame) { if (nsnull != frame) {
frame->SetStyleContext(aPresContext, childStyleContext); frame->SetStyleContext(aPresContext, childStyleContext);
// Process the children, and initialize the frame // Process the children, and set the frame's initial child list
nsIFrame* childChildList; nsIFrame* childChildList;
ProcessChildren(aPresContext, frame, childContent, childChildList); ProcessChildren(aPresContext, frame, childContent, childChildList);
frame->Init(*aPresContext, childChildList); frame->SetInitialChildList(*aPresContext, nsnull, childChildList);
// Link the frame into the child list // Link the frame into the child list
if (nsnull == lastChildFrame) { if (nsnull == lastChildFrame) {
@@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
} }
} }
// Initialize the inner table with its child list // Set the inner table frame's list of initial child frames
innerFrame->Init(*aPresContext, innerChildList); innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList);
// Initialize the anonymous table outer frame // Set the anonymous table outer frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
return NS_OK; return NS_OK;
} }
@@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle);
NS_RELEASE(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); rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
pageSequenceFrame->Init(*aPresContext, childList); pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList);
// Set the root frame's initial child list // Set the root frame's initial child list
aNewFrame->Init(*aPresContext, pageSequenceFrame); aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
} }
} }
} else { } else {
nsIFrame* childList; 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aNewFrame); aStyleContext, aNewFrame);
// Note: table construction function takes care of setting the style context, // 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; return rv;
case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
@@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
// Set the scroll frame's initial child list and return the scroll frame // Set the scroll frame's initial child list and return the scroll frame
// as the frame sub-tree // as the frame sub-tree
if (nsnull != scrollFrame) { if (nsnull != scrollFrame) {
scrollFrame->Init(*aPresContext, aFrameSubTree); scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree);
aFrameSubTree = scrollFrame; aFrameSubTree = scrollFrame;
} }
} }

View File

@@ -125,18 +125,24 @@ class nsIFrame : public nsISupports
{ {
public: 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 * This is only called once for a given child list, and won't be called
* constructed. * at all for child lists with no initial list of frames.
* *
* You should reflow the frames when you get your 'initial' reflow * @param aListName the name of the child list. A NULL pointer for the atom
* notification. * name means the unnamed principal child list
* * @param aChildList list of child frames
* @param aChildList list of child frames. May be NULL * @return NS_ERROR_INVALID_ARG if there is no child list with the specified
* @see #Reflow() * 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 * Add this object's size information to the sizeof handler. Note that

View File

@@ -59,7 +59,9 @@ public:
nsFieldSetFrame(nsIContent* aContent, nsIFrame* aParentFrame); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
@@ -115,7 +117,9 @@ nsFieldSetFrame::~nsFieldSetFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// cache our display type // cache our display type
const nsStyleDisplay* styleDisplay; const nsStyleDisplay* styleDisplay;
@@ -163,7 +167,7 @@ nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
} }
// Queue up the frames for the content frame // 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. // this is identical to nsHTMLContainerFrame::Paint except for the background and border.

View File

@@ -207,7 +207,9 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFormControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// add ourself as an nsIFormControlFrame // add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);

View File

@@ -111,7 +111,9 @@ public:
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext, NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus); nsDidReflowStatus aStatus);

View File

@@ -79,7 +79,9 @@ public:
nsGUIEvent* aEvent, nsGUIEvent* aEvent,
nsEventStatus& aEventStatus); nsEventStatus& aEventStatus);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter);
NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetType(PRInt32* aType) const;
@@ -525,7 +527,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// add ourself as an nsIFormControlFrame // add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);
@@ -577,7 +581,7 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLis
} }
// Queue up the frames for the inline frame // Queue up the frames for the inline frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -62,7 +62,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
nsGUIEvent* aEvent, nsGUIEvent* aEvent,
@@ -155,7 +157,9 @@ nsrefcnt nsImageControlFrame::Release(void)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsImageControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);
if (nsnull == mFormFrame) { if (nsnull == mFormFrame) {

View File

@@ -87,7 +87,9 @@ nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// cache our display type // cache our display type
const nsStyleDisplay* styleDisplay; const nsStyleDisplay* styleDisplay;
@@ -110,7 +112,7 @@ nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
} }
// Queue up the frames for the inline frame // Queue up the frames for the inline frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -37,7 +37,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -54,12 +54,23 @@ nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
nsresult result;
if (nsnull != mFirstChild) {
result = NS_ERROR_UNEXPECTED;
} else if (nsnull != aListName) {
result = NS_ERROR_INVALID_ARG;
} else {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; result = NS_OK;
}
return result;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -28,7 +28,9 @@ class nsContainerFrame : public nsSplittableFrame
public: public:
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; 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);

View File

@@ -294,14 +294,19 @@ nsrefcnt nsFrame::Release(void)
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// nsIFrame // nsIFrame
NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
if (nsnull != aChildList) { // XXX This shouldn't be getting called at all, but currently is for backwards
// compatility reasons...
#if 0
NS_ERROR("not a container"); NS_ERROR("not a container");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} #else
NS_ASSERTION(nsnull == aChildList, "not a container");
return NS_OK; return NS_OK;
#endif
} }
NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext)

View File

@@ -112,7 +112,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
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 SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
NS_IMETHOD GetContent(nsIContent*& aContent) const; NS_IMETHOD GetContent(nsIContent*& aContent) const;

View File

@@ -231,7 +231,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
NS_RELEASE(pseudoStyle); NS_RELEASE(pseudoStyle);
// Init the body frame // Init the body frame
aWrapperFrame->Init(aPresContext, aFrame); aWrapperFrame->SetInitialChildList(aPresContext, nsnull, aFrame);
} }
NS_RELEASE(content); NS_RELEASE(content);

View File

@@ -45,7 +45,9 @@ class RootFrame : public nsHTMLContainerFrame {
public: public:
RootFrame(nsIContent* aContent); RootFrame(nsIContent* aContent);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
@@ -82,30 +84,12 @@ RootFrame::RootFrame(nsIContent* aContent)
} }
NS_IMETHODIMP 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; mFirstChild = aChildList;
return NS_OK; return NS_OK;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -125,18 +125,24 @@ class nsIFrame : public nsISupports
{ {
public: 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 * This is only called once for a given child list, and won't be called
* constructed. * at all for child lists with no initial list of frames.
* *
* You should reflow the frames when you get your 'initial' reflow * @param aListName the name of the child list. A NULL pointer for the atom
* notification. * name means the unnamed principal child list
* * @param aChildList list of child frames
* @param aChildList list of child frames. May be NULL * @return NS_ERROR_INVALID_ARG if there is no child list with the specified
* @see #Reflow() * 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 * Add this object's size information to the sizeof handler. Note that

View File

@@ -60,7 +60,9 @@ public:
virtual ~nsInlineFrame(); virtual ~nsInlineFrame();
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX, NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX,
nsIFrame* aParent, nsIFrame* aParent,
nsIStyleContext* aStyleContext, nsIStyleContext* aStyleContext,
@@ -237,7 +239,9 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);

View File

@@ -30,7 +30,9 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsIContent* aContent, nsIFr
} }
NS_IMETHODIMP 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 // Create a page frame and set its style context
mFirstChild = new nsPageFrame(mContent, this); mFirstChild = new nsPageFrame(mContent, this);
@@ -49,7 +51,7 @@ nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLi
} }
// Queue up the frames for the page frame // Queue up the frames for the page frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
// XXX Hack // XXX Hack

View File

@@ -25,7 +25,9 @@ class nsSimplePageSequenceFrame : public nsContainerFrame {
public: public:
nsSimplePageSequenceFrame(nsIContent* aContent, nsIFrame* aParent); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -259,7 +259,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aParentContext); nsIStyleContext* aParentContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
@@ -1618,7 +1620,9 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsBlockFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBlockFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);
if (NS_OK != rv) { if (NS_OK != rv) {

View File

@@ -88,7 +88,9 @@ nsBodyFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
// nsIFrame // nsIFrame
NS_IMETHODIMP NS_IMETHODIMP
nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsBodyFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
if (nsnull == mPrevInFlow) { if (nsnull == mPrevInFlow) {
// Create a block frame and set its style context // 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 // Queue up the frames for the block frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} else { } else {
// We have a prev-in-flow, so create a continuing block frame // 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, prevBodyFrame->mFirstChild->CreateContinuingFrame(aPresContext, this,
blockStyleContext, mFirstChild); blockStyleContext, mFirstChild);
NS_RELEASE(blockStyleContext); 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; return NS_ERROR_OUT_OF_MEMORY;
} }
PrepareContinuingFrame(aPresContext, aParent, aStyleContext, cf); PrepareContinuingFrame(aPresContext, aParent, aStyleContext, cf);
cf->Init(aPresContext, nsnull); cf->SetInitialChildList(aPresContext, nsnull, nsnull);
aContinuingFrame = cf; aContinuingFrame = cf;
return NS_OK; return NS_OK;
} }

View File

@@ -37,7 +37,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -54,12 +54,23 @@ nsContainerFrame::SizeOf(nsISizeOfHandler* aHandler) const
} }
NS_IMETHODIMP NS_IMETHODIMP
nsContainerFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsContainerFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
nsresult result;
if (nsnull != mFirstChild) {
result = NS_ERROR_UNEXPECTED;
} else if (nsnull != aListName) {
result = NS_ERROR_INVALID_ARG;
} else {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; result = NS_OK;
}
return result;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -28,7 +28,9 @@ class nsContainerFrame : public nsSplittableFrame
public: public:
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; 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);

View File

@@ -294,14 +294,19 @@ nsrefcnt nsFrame::Release(void)
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// nsIFrame // nsIFrame
NS_IMETHODIMP nsFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) NS_IMETHODIMP nsFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
if (nsnull != aChildList) { // XXX This shouldn't be getting called at all, but currently is for backwards
// compatility reasons...
#if 0
NS_ERROR("not a container"); NS_ERROR("not a container");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} #else
NS_ASSERTION(nsnull == aChildList, "not a container");
return NS_OK; return NS_OK;
#endif
} }
NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext) NS_IMETHODIMP nsFrame::DeleteFrame(nsIPresContext& aPresContext)

View File

@@ -112,7 +112,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame // nsIFrame
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 SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const;
NS_IMETHOD GetContent(nsIContent*& aContent) const; NS_IMETHOD GetContent(nsIContent*& aContent) const;

View File

@@ -231,7 +231,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
NS_RELEASE(pseudoStyle); NS_RELEASE(pseudoStyle);
// Init the body frame // Init the body frame
aWrapperFrame->Init(aPresContext, aFrame); aWrapperFrame->SetInitialChildList(aPresContext, nsnull, aFrame);
} }
NS_RELEASE(content); NS_RELEASE(content);

View File

@@ -45,7 +45,9 @@ class RootFrame : public nsHTMLContainerFrame {
public: public:
RootFrame(nsIContent* aContent); RootFrame(nsIContent* aContent);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
@@ -82,30 +84,12 @@ RootFrame::RootFrame(nsIContent* aContent)
} }
NS_IMETHODIMP 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; mFirstChild = aChildList;
return NS_OK; return NS_OK;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -60,7 +60,9 @@ public:
virtual ~nsInlineFrame(); virtual ~nsInlineFrame();
// nsIFrame // nsIFrame
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX, NS_IMETHOD CreateContinuingFrame(nsIPresContext& aCX,
nsIFrame* aParent, nsIFrame* aParent,
nsIStyleContext* aStyleContext, nsIStyleContext* aStyleContext,
@@ -237,7 +239,9 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsInlineFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
NS_PRECONDITION(nsnull == mFirstChild, "already initialized"); NS_PRECONDITION(nsnull == mFirstChild, "already initialized");
nsresult rv = AppendNewFrames(aPresContext, aChildList); nsresult rv = AppendNewFrames(aPresContext, aChildList);

View File

@@ -48,7 +48,9 @@ class nsScrollFrame : public nsHTMLContainerFrame {
public: public:
nsScrollFrame(nsIContent* aContent, nsIFrame* aParent); 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, NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus); nsDidReflowStatus aStatus);
@@ -77,7 +79,9 @@ nsScrollFrame::nsScrollFrame(nsIContent* aContent, nsIFrame* aParent)
} }
NS_IMETHODIMP 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(nsnull != aChildList, "no child frame");
NS_PRECONDITION(LengthOf(aChildList) == 1, "wrong number child frames"); NS_PRECONDITION(LengthOf(aChildList) == 1, "wrong number child frames");

View File

@@ -30,7 +30,9 @@ nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsIContent* aContent, nsIFr
} }
NS_IMETHODIMP 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 // Create a page frame and set its style context
mFirstChild = new nsPageFrame(mContent, this); mFirstChild = new nsPageFrame(mContent, this);
@@ -49,7 +51,7 @@ nsSimplePageSequenceFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLi
} }
// Queue up the frames for the page frame // Queue up the frames for the page frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
// XXX Hack // XXX Hack

View File

@@ -25,7 +25,9 @@ class nsSimplePageSequenceFrame : public nsContainerFrame {
public: public:
nsSimplePageSequenceFrame(nsIContent* aContent, nsIFrame* aParent); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -59,7 +59,9 @@ public:
nsFieldSetFrame(nsIContent* aContent, nsIFrame* aParentFrame); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
@@ -115,7 +117,9 @@ nsFieldSetFrame::~nsFieldSetFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// cache our display type // cache our display type
const nsStyleDisplay* styleDisplay; const nsStyleDisplay* styleDisplay;
@@ -163,7 +167,7 @@ nsFieldSetFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
} }
// Queue up the frames for the content frame // 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. // this is identical to nsHTMLContainerFrame::Paint except for the background and border.

View File

@@ -207,7 +207,9 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFormControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsFormControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// add ourself as an nsIFormControlFrame // add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);

View File

@@ -111,7 +111,9 @@ public:
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext, NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus); nsDidReflowStatus aStatus);

View File

@@ -207,7 +207,9 @@ nsFormFrame::GetEnctype(PRInt32* aEnctype)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsFormFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsFormFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult result = NS_OK; nsresult result = NS_OK;
nsIDOMHTMLFormElement* content = nsnull; nsIDOMHTMLFormElement* content = nsnull;

View File

@@ -79,7 +79,9 @@ class nsFormFrame : public nsLeafFrame,
public: public:
nsFormFrame(nsIContent* aContent, nsIFrame* aParentFrame); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -79,7 +79,9 @@ public:
nsGUIEvent* aEvent, nsGUIEvent* aEvent,
nsEventStatus& aEventStatus); nsEventStatus& aEventStatus);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter);
NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetType(PRInt32* aType) const;
@@ -525,7 +527,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// add ourself as an nsIFormControlFrame // add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);
@@ -577,7 +581,7 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildLis
} }
// Queue up the frames for the inline frame // Queue up the frames for the inline frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -62,7 +62,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
nsGUIEvent* aEvent, nsGUIEvent* aEvent,
@@ -155,7 +157,9 @@ nsrefcnt nsImageControlFrame::Release(void)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsImageControlFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsImageControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsFormFrame::AddFormControlFrame(aPresContext, *this); nsFormFrame::AddFormControlFrame(aPresContext, *this);
if (nsnull == mFormFrame) { if (nsnull == mFormFrame) {

View File

@@ -73,7 +73,9 @@ public:
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,
@@ -394,7 +396,9 @@ nsLabelFrame::FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aRe
NS_IMETHODIMP 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 // create our view, we need a view to grab the mouse
nsIView* view; nsIView* view;
@@ -439,7 +443,7 @@ nsLabelFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
} }
// Queue up the frames for the body frame // Queue up the frames for the body frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -87,7 +87,9 @@ nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsLegendFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// cache our display type // cache our display type
const nsStyleDisplay* styleDisplay; const nsStyleDisplay* styleDisplay;
@@ -110,7 +112,7 @@ nsLegendFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
} }
// Queue up the frames for the inline frame // Queue up the frames for the inline frame
return mFirstChild->Init(aPresContext, aChildList); return mFirstChild->SetInitialChildList(aPresContext, nsnull, aChildList);
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -37,7 +37,9 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize, nsHTMLReflowMetrics& aDesiredSize,

View File

@@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_NewBodyFrame(childContent, aNewFrame, captionFrame,
NS_BODY_NO_AUTO_MARGINS); NS_BODY_NO_AUTO_MARGINS);
captionFrame->SetStyleContext(aPresContext, childStyleContext); 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; nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, 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 // Prepend the caption frame to the outer frame's child list
innerFrame->SetNextSibling(captionFrame); innerFrame->SetNextSibling(captionFrame);
@@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull != frame) { if (nsnull != frame) {
frame->SetStyleContext(aPresContext, childStyleContext); frame->SetStyleContext(aPresContext, childStyleContext);
// Process the children, and initialize the frame // Process the children, and set the frame's initial child list
nsIFrame* childChildList; nsIFrame* childChildList;
ProcessChildren(aPresContext, frame, childContent, childChildList); ProcessChildren(aPresContext, frame, childContent, childChildList);
frame->Init(*aPresContext, childChildList); frame->SetInitialChildList(*aPresContext, nsnull, childChildList);
// Link the frame into the child list // Link the frame into the child list
if (nsnull == lastChildFrame) { if (nsnull == lastChildFrame) {
@@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
} }
} }
// Initialize the inner table with its child list // Set the inner table frame's list of initial child frames
innerFrame->Init(*aPresContext, innerChildList); innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList);
// Initialize the anonymous table outer frame // Set the anonymous table outer frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
return NS_OK; return NS_OK;
} }
@@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle);
NS_RELEASE(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); rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
pageSequenceFrame->Init(*aPresContext, childList); pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList);
// Set the root frame's initial child list // Set the root frame's initial child list
aNewFrame->Init(*aPresContext, pageSequenceFrame); aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
} }
} }
} else { } else {
nsIFrame* childList; 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aNewFrame); aStyleContext, aNewFrame);
// Note: table construction function takes care of setting the style context, // 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; return rv;
case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
@@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
// Set the scroll frame's initial child list and return the scroll frame // Set the scroll frame's initial child list and return the scroll frame
// as the frame sub-tree // as the frame sub-tree
if (nsnull != scrollFrame) { if (nsnull != scrollFrame) {
scrollFrame->Init(*aPresContext, aFrameSubTree); scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree);
aFrameSubTree = scrollFrame; aFrameSubTree = scrollFrame;
} }
} }

View File

@@ -70,7 +70,9 @@ nsTableCellFrame::~nsTableCellFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableCellFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// Create body pseudo frame // Create body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild, NS_BODY_NO_AUTO_MARGINS); 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 // 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, NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,

View File

@@ -53,7 +53,9 @@ public:
// nsISupports // nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,

View File

@@ -108,7 +108,7 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi
nsIStyleContextPtr colStyleContext = nsIStyleContextPtr colStyleContext =
aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE);
colFrame->SetStyleContext(&aPresContext, colStyleContext); colFrame->SetStyleContext(&aPresContext, colStyleContext);
colFrame->Init(aPresContext, nsnull); colFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
// Set nsColFrame-specific information // Set nsColFrame-specific information
PRInt32 absColIndex = mStartColIndex + colIndex; PRInt32 absColIndex = mStartColIndex + colIndex;
@@ -159,7 +159,9 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableColGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult result = AppendNewFrames(aPresContext, aChildList); nsresult result = AppendNewFrames(aPresContext, aChildList);
if (NS_OK==result) if (NS_OK==result)

View File

@@ -45,7 +45,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,

View File

@@ -300,7 +300,9 @@ nsTableFrame::~nsTableFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv=NS_OK; nsresult rv=NS_OK;
mFirstChild = aChildList; mFirstChild = aChildList;
@@ -740,7 +742,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
nsIStyleContextPtr colStyleContext = nsIStyleContextPtr colStyleContext =
aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE); aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE);
colFrame->SetStyleContext(&aPresContext, colStyleContext); 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).\ // XXX Don't release this style context (or we'll end up with a double-free).\
// This code is doing what nsTableColGroupFrame::Reflow() does... // This code is doing what nsTableColGroupFrame::Reflow() does...
@@ -755,7 +757,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
lastNewColFrame = colFrame; lastNewColFrame = colFrame;
NS_RELEASE(col); // ADDREF: col-- NS_RELEASE(col); // ADDREF: col--
} }
lastColGroupFrame->Init(aPresContext, firstNewColFrame); lastColGroupFrame->SetInitialChildList(aPresContext, nsnull, firstNewColFrame);
NS_RELEASE(lastColGroup); // ADDREF: lastColGroup-- NS_RELEASE(lastColGroup); // ADDREF: lastColGroup--
} }
} }

View File

@@ -92,7 +92,9 @@ public:
*/ */
PRBool IsRowGroup(PRInt32 aDisplayType); 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 /** complete the append of aRowGroupFrame to the table
* this builds the cell map * this builds the cell map

View File

@@ -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; mFirstChild = aChildList;

View File

@@ -50,7 +50,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,

View File

@@ -98,7 +98,9 @@ nsTableRowFrame::~nsTableRowFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableRowFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; return NS_OK;

View File

@@ -58,7 +58,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,

View File

@@ -155,7 +155,9 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
NS_IMETHODIMP NS_IMETHODIMP
nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; return NS_OK;

View File

@@ -52,7 +52,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,

View File

@@ -976,10 +976,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
NS_NewBodyFrame(childContent, aNewFrame, captionFrame, NS_NewBodyFrame(childContent, aNewFrame, captionFrame,
NS_BODY_NO_AUTO_MARGINS); NS_BODY_NO_AUTO_MARGINS);
captionFrame->SetStyleContext(aPresContext, childStyleContext); 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; nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, 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 // Prepend the caption frame to the outer frame's child list
innerFrame->SetNextSibling(captionFrame); innerFrame->SetNextSibling(captionFrame);
@@ -1011,10 +1011,10 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull != frame) { if (nsnull != frame) {
frame->SetStyleContext(aPresContext, childStyleContext); frame->SetStyleContext(aPresContext, childStyleContext);
// Process the children, and initialize the frame // Process the children, and set the frame's initial child list
nsIFrame* childChildList; nsIFrame* childChildList;
ProcessChildren(aPresContext, frame, childContent, childChildList); ProcessChildren(aPresContext, frame, childContent, childChildList);
frame->Init(*aPresContext, childChildList); frame->SetInitialChildList(*aPresContext, nsnull, childChildList);
// Link the frame into the child list // Link the frame into the child list
if (nsnull == lastChildFrame) { if (nsnull == lastChildFrame) {
@@ -1030,11 +1030,11 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
} }
} }
// Initialize the inner table with its child list // Set the inner table frame's list of initial child frames
innerFrame->Init(*aPresContext, innerChildList); innerFrame->SetInitialChildList(*aPresContext, nsnull, innerChildList);
// Initialize the anonymous table outer frame // Set the anonymous table outer frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
return NS_OK; return NS_OK;
} }
@@ -1098,22 +1098,23 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle); pageSequenceFrame->SetStyleContext(aPresContext, pseudoStyle);
NS_RELEASE(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); rv = ProcessChildren(aPresContext, pageSequenceFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
pageSequenceFrame->Init(*aPresContext, childList); pageSequenceFrame->SetInitialChildList(*aPresContext, nsnull, childList);
// Set the root frame's initial child list // Set the root frame's initial child list
aNewFrame->Init(*aPresContext, pageSequenceFrame); aNewFrame->SetInitialChildList(*aPresContext, nsnull, pageSequenceFrame);
} }
} }
} else { } else {
nsIFrame* childList; 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
if (NS_SUCCEEDED(rv)) { 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); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1253,7 +1254,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ConstructTableFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aNewFrame); aStyleContext, aNewFrame);
// Note: table construction function takes care of setting the style context, // 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; return rv;
case NS_STYLE_DISPLAY_TABLE_ROW_GROUP: case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
@@ -1325,8 +1326,8 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresContext,
rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList); rv = ProcessChildren(aPresContext, aNewFrame, aContent, childList);
} }
// Initialize the frame // Set the frame's initial child list
aNewFrame->Init(*aPresContext, childList); aNewFrame->SetInitialChildList(*aPresContext, nsnull, childList);
} }
return rv; return rv;
@@ -1513,7 +1514,7 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
// Set the scroll frame's initial child list and return the scroll frame // Set the scroll frame's initial child list and return the scroll frame
// as the frame sub-tree // as the frame sub-tree
if (nsnull != scrollFrame) { if (nsnull != scrollFrame) {
scrollFrame->Init(*aPresContext, aFrameSubTree); scrollFrame->SetInitialChildList(*aPresContext, nsnull, aFrameSubTree);
aFrameSubTree = scrollFrame; aFrameSubTree = scrollFrame;
} }
} }

View File

@@ -70,7 +70,9 @@ nsTableCellFrame::~nsTableCellFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableCellFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableCellFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
// Create body pseudo frame // Create body pseudo frame
NS_NewBodyFrame(mContent, this, mFirstChild, NS_BODY_NO_AUTO_MARGINS); 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 // 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, NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,

View File

@@ -53,7 +53,9 @@ public:
// nsISupports // nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); 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, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,

View File

@@ -108,7 +108,7 @@ nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChi
nsIStyleContextPtr colStyleContext = nsIStyleContextPtr colStyleContext =
aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE); aPresContext.ResolveStyleContextFor(col, mStyleContext, PR_TRUE);
colFrame->SetStyleContext(&aPresContext, colStyleContext); colFrame->SetStyleContext(&aPresContext, colStyleContext);
colFrame->Init(aPresContext, nsnull); colFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
// Set nsColFrame-specific information // Set nsColFrame-specific information
PRInt32 absColIndex = mStartColIndex + colIndex; PRInt32 absColIndex = mStartColIndex + colIndex;
@@ -159,7 +159,9 @@ nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aC
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableColGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult result = AppendNewFrames(aPresContext, aChildList); nsresult result = AppendNewFrames(aPresContext, aChildList);
if (NS_OK==result) if (NS_OK==result)

View File

@@ -45,7 +45,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext, nsIRenderingContext& aRenderingContext,

View File

@@ -300,7 +300,9 @@ nsTableFrame::~nsTableFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
nsresult rv=NS_OK; nsresult rv=NS_OK;
mFirstChild = aChildList; mFirstChild = aChildList;
@@ -740,7 +742,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
nsIStyleContextPtr colStyleContext = nsIStyleContextPtr colStyleContext =
aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE); aPresContext.ResolveStyleContextFor(col, lastColGroupStyle, PR_TRUE);
colFrame->SetStyleContext(&aPresContext, colStyleContext); 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).\ // XXX Don't release this style context (or we'll end up with a double-free).\
// This code is doing what nsTableColGroupFrame::Reflow() does... // This code is doing what nsTableColGroupFrame::Reflow() does...
@@ -755,7 +757,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
lastNewColFrame = colFrame; lastNewColFrame = colFrame;
NS_RELEASE(col); // ADDREF: col-- NS_RELEASE(col); // ADDREF: col--
} }
lastColGroupFrame->Init(aPresContext, firstNewColFrame); lastColGroupFrame->SetInitialChildList(aPresContext, nsnull, firstNewColFrame);
NS_RELEASE(lastColGroup); // ADDREF: lastColGroup-- NS_RELEASE(lastColGroup); // ADDREF: lastColGroup--
} }
} }

View File

@@ -92,7 +92,9 @@ public:
*/ */
PRBool IsRowGroup(PRInt32 aDisplayType); 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 /** complete the append of aRowGroupFrame to the table
* this builds the cell map * this builds the cell map

View File

@@ -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; mFirstChild = aChildList;

View File

@@ -50,7 +50,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,

View File

@@ -98,7 +98,9 @@ nsTableRowFrame::~nsTableRowFrame()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsTableRowFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableRowFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; return NS_OK;

View File

@@ -58,7 +58,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,

View File

@@ -155,7 +155,9 @@ NS_METHOD nsTableRowGroupFrame::GetMaxColumns(PRInt32 &aMaxColumns) const
NS_IMETHODIMP NS_IMETHODIMP
nsTableRowGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList) nsTableRowGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{ {
mFirstChild = aChildList; mFirstChild = aChildList;
return NS_OK; return NS_OK;

View File

@@ -52,7 +52,9 @@ public:
nsIFrame* aParentFrame, nsIFrame* aParentFrame,
nsIFrame*& aResult); nsIFrame*& aResult);
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
/** @see nsIFrame::Paint */ /** @see nsIFrame::Paint */
NS_IMETHOD Paint(nsIPresContext& aPresContext, NS_IMETHOD Paint(nsIPresContext& aPresContext,