Fixed some problem in ConstructFrameByDisplayType() where in now cases

(e.g. floaters and relatively positioned blocks) the newly constructed
frame wasn't getting added to aFrameItems
This commit is contained in:
troy%netscape.com 1999-01-26 05:46:04 +00:00
Родитель 8aeccdd602
Коммит 3c1d7d5b17
3 изменённых файлов: 162 добавлений и 165 удалений

Просмотреть файл

@ -2504,15 +2504,13 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
{ {
PRBool isAbsolutelyPositioned = PR_FALSE; PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel(); PRBool isBlock = aDisplay->IsBlockLevel();
nsIFrame* newFrame = nsnull; // the frame we construct
nsresult rv = NS_OK; nsresult rv = NS_OK;
// Get the position syle info // Get the position syle info
const nsStylePosition* position = (const nsStylePosition*) const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position); aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
// The frame is also a block if it's an inline frame that's floated or // The frame is also a block if it's an inline frame that's floated or
// absolutely positioned // absolutely positioned
if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) && if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) &&
@ -2538,7 +2536,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// Initialize it // Initialize it
InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext, InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext,
aAbsoluteItems, aNewFrame, isAbsolutelyPositioned, PR_FALSE); aAbsoluteItems, newFrame, isAbsolutelyPositioned, PR_FALSE);
#if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame" #if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame"
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
@ -2566,7 +2564,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// The area frame becomes a container for child frames that are // The area frame becomes a container for child frames that are
// absolutely positioned // absolutely positioned
nsAbsoluteItems absoluteItems(scrolledFrame); nsAbsoluteItems absoluteItems(scrolledFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems, ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems,
childItems); childItems);
@ -2598,24 +2596,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
isAbsolutelyPositioned = PR_TRUE; isAbsolutelyPositioned = PR_TRUE;
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, 0); NS_NewAreaFrame(newFrame, 0);
aNewFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock, newFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock,
aStyleContext); aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. The area frame becomes a container for child // Process the child content. The area frame becomes a container for child
// frames that are absolutely positioned // frames that are absolutely positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems);
ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
@ -2626,45 +2625,45 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
(NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) { (NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) {
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, NS_BLOCK_SHRINK_WRAP); NS_NewAreaFrame(newFrame, NS_BLOCK_SHRINK_WRAP);
// Initialize the frame // Initialize the frame
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view // See if we need to create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content // Process the child content
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
// See if it's a relatively positioned block // See if it's a relatively positioned block
} else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) && } else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) &&
((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) { ((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) {
// Create an area frame. No space manager, though // Create an area frame. No space manager, though
NS_NewAreaFrame(aNewFrame, NS_AREA_NO_SPACE_MGR); NS_NewAreaFrame(newFrame, NS_AREA_NO_SPACE_MGR);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. Relatively positioned frames becomes a // Process the child content. Relatively positioned frames becomes a
// container for child frames that are positioned // container for child frames that are positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
} else { } else {
@ -2676,12 +2675,12 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_LIST_ITEM: case NS_STYLE_DISPLAY_LIST_ITEM:
case NS_STYLE_DISPLAY_RUN_IN: case NS_STYLE_DISPLAY_RUN_IN:
case NS_STYLE_DISPLAY_COMPACT: case NS_STYLE_DISPLAY_COMPACT:
rv = NS_NewBlockFrame(aNewFrame, 0); rv = NS_NewBlockFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_INLINE: case NS_STYLE_DISPLAY_INLINE:
rv = NS_NewInlineFrame(aNewFrame); rv = NS_NewInlineFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2691,25 +2690,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
aParentFrame; aParentFrame;
rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext, rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext,
aAbsoluteItems, aNewFrame); aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
// Add the table frame to the list of items
aFrameItems.AddChild(aNewFrame);
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else {
// Add the table frame to the flow
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;
} }
@ -2726,7 +2725,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableRowGroupFrame(aNewFrame); rv = NS_NewTableRowGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2734,7 +2733,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_COLUMN: case NS_STYLE_DISPLAY_TABLE_COLUMN:
// XXX We should check for being inside of a table column group... // XXX We should check for being inside of a table column group...
rv = NS_NewTableColFrame(aNewFrame); rv = NS_NewTableColFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2745,7 +2744,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableColGroupFrame(aNewFrame); rv = NS_NewTableColGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2753,22 +2752,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_ROW: case NS_STYLE_DISPLAY_TABLE_ROW:
// XXX We should check for being inside of a table row group... // XXX We should check for being inside of a table row group...
rv = NS_NewTableRowFrame(aNewFrame); rv = NS_NewTableRowFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_TABLE_CELL: case NS_STYLE_DISPLAY_TABLE_CELL:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aAbsoluteItems, aNewFrame); aStyleContext, aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
aFrameItems.AddChild(aNewFrame); aFrameItems.AddChild(newFrame);
return rv; return rv;
case NS_STYLE_DISPLAY_TABLE_CAPTION: case NS_STYLE_DISPLAY_TABLE_CAPTION:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = NS_NewAreaFrame(aNewFrame, 0); rv = NS_NewAreaFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2779,26 +2778,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// If we succeeded in creating a frame then initialize the frame and // If we succeeded in creating a frame then initialize the frame and
// process children if requested // process children if requested
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) { if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Add the frame to the list of items.
aFrameItems.AddChild(aNewFrame);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view, e.g. the frame is absolutely positioned // See if we need to create a view, e.g. the frame is absolutely positioned
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content if requested // Process the child content if requested
nsFrameItems childItems; nsFrameItems childItems;
if (processChildren) { if (processChildren) {
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
childItems); childItems);
} }
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
} }
} }
@ -2806,15 +2801,19 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else if (nsnull != newFrame) {
// Add the frame we just created to the flowed list
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;

Просмотреть файл

@ -2504,15 +2504,13 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
{ {
PRBool isAbsolutelyPositioned = PR_FALSE; PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel(); PRBool isBlock = aDisplay->IsBlockLevel();
nsIFrame* newFrame = nsnull; // the frame we construct
nsresult rv = NS_OK; nsresult rv = NS_OK;
// Get the position syle info // Get the position syle info
const nsStylePosition* position = (const nsStylePosition*) const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position); aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
// The frame is also a block if it's an inline frame that's floated or // The frame is also a block if it's an inline frame that's floated or
// absolutely positioned // absolutely positioned
if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) && if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) &&
@ -2538,7 +2536,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// Initialize it // Initialize it
InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext, InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext,
aAbsoluteItems, aNewFrame, isAbsolutelyPositioned, PR_FALSE); aAbsoluteItems, newFrame, isAbsolutelyPositioned, PR_FALSE);
#if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame" #if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame"
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
@ -2566,7 +2564,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// The area frame becomes a container for child frames that are // The area frame becomes a container for child frames that are
// absolutely positioned // absolutely positioned
nsAbsoluteItems absoluteItems(scrolledFrame); nsAbsoluteItems absoluteItems(scrolledFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems, ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems,
childItems); childItems);
@ -2598,24 +2596,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
isAbsolutelyPositioned = PR_TRUE; isAbsolutelyPositioned = PR_TRUE;
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, 0); NS_NewAreaFrame(newFrame, 0);
aNewFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock, newFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock,
aStyleContext); aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. The area frame becomes a container for child // Process the child content. The area frame becomes a container for child
// frames that are absolutely positioned // frames that are absolutely positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems);
ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
@ -2626,45 +2625,45 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
(NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) { (NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) {
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, NS_BLOCK_SHRINK_WRAP); NS_NewAreaFrame(newFrame, NS_BLOCK_SHRINK_WRAP);
// Initialize the frame // Initialize the frame
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view // See if we need to create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content // Process the child content
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
// See if it's a relatively positioned block // See if it's a relatively positioned block
} else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) && } else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) &&
((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) { ((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) {
// Create an area frame. No space manager, though // Create an area frame. No space manager, though
NS_NewAreaFrame(aNewFrame, NS_AREA_NO_SPACE_MGR); NS_NewAreaFrame(newFrame, NS_AREA_NO_SPACE_MGR);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. Relatively positioned frames becomes a // Process the child content. Relatively positioned frames becomes a
// container for child frames that are positioned // container for child frames that are positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
} else { } else {
@ -2676,12 +2675,12 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_LIST_ITEM: case NS_STYLE_DISPLAY_LIST_ITEM:
case NS_STYLE_DISPLAY_RUN_IN: case NS_STYLE_DISPLAY_RUN_IN:
case NS_STYLE_DISPLAY_COMPACT: case NS_STYLE_DISPLAY_COMPACT:
rv = NS_NewBlockFrame(aNewFrame, 0); rv = NS_NewBlockFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_INLINE: case NS_STYLE_DISPLAY_INLINE:
rv = NS_NewInlineFrame(aNewFrame); rv = NS_NewInlineFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2691,25 +2690,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
aParentFrame; aParentFrame;
rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext, rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext,
aAbsoluteItems, aNewFrame); aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
// Add the table frame to the list of items
aFrameItems.AddChild(aNewFrame);
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else {
// Add the table frame to the flow
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;
} }
@ -2726,7 +2725,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableRowGroupFrame(aNewFrame); rv = NS_NewTableRowGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2734,7 +2733,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_COLUMN: case NS_STYLE_DISPLAY_TABLE_COLUMN:
// XXX We should check for being inside of a table column group... // XXX We should check for being inside of a table column group...
rv = NS_NewTableColFrame(aNewFrame); rv = NS_NewTableColFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2745,7 +2744,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableColGroupFrame(aNewFrame); rv = NS_NewTableColGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2753,22 +2752,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_ROW: case NS_STYLE_DISPLAY_TABLE_ROW:
// XXX We should check for being inside of a table row group... // XXX We should check for being inside of a table row group...
rv = NS_NewTableRowFrame(aNewFrame); rv = NS_NewTableRowFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_TABLE_CELL: case NS_STYLE_DISPLAY_TABLE_CELL:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aAbsoluteItems, aNewFrame); aStyleContext, aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
aFrameItems.AddChild(aNewFrame); aFrameItems.AddChild(newFrame);
return rv; return rv;
case NS_STYLE_DISPLAY_TABLE_CAPTION: case NS_STYLE_DISPLAY_TABLE_CAPTION:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = NS_NewAreaFrame(aNewFrame, 0); rv = NS_NewAreaFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2779,26 +2778,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// If we succeeded in creating a frame then initialize the frame and // If we succeeded in creating a frame then initialize the frame and
// process children if requested // process children if requested
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) { if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Add the frame to the list of items.
aFrameItems.AddChild(aNewFrame);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view, e.g. the frame is absolutely positioned // See if we need to create a view, e.g. the frame is absolutely positioned
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content if requested // Process the child content if requested
nsFrameItems childItems; nsFrameItems childItems;
if (processChildren) { if (processChildren) {
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
childItems); childItems);
} }
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
} }
} }
@ -2806,15 +2801,19 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else if (nsnull != newFrame) {
// Add the frame we just created to the flowed list
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;

Просмотреть файл

@ -2504,15 +2504,13 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
{ {
PRBool isAbsolutelyPositioned = PR_FALSE; PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel(); PRBool isBlock = aDisplay->IsBlockLevel();
nsIFrame* newFrame = nsnull; // the frame we construct
nsresult rv = NS_OK; nsresult rv = NS_OK;
// Get the position syle info // Get the position syle info
const nsStylePosition* position = (const nsStylePosition*) const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position); aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
// The frame is also a block if it's an inline frame that's floated or // The frame is also a block if it's an inline frame that's floated or
// absolutely positioned // absolutely positioned
if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) && if ((NS_STYLE_DISPLAY_INLINE == aDisplay->mDisplay) &&
@ -2538,7 +2536,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// Initialize it // Initialize it
InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext, InitializeScrollFrame(scrollFrame, aPresContext, aContent, aParentFrame, aStyleContext,
aAbsoluteItems, aNewFrame, isAbsolutelyPositioned, PR_FALSE); aAbsoluteItems, newFrame, isAbsolutelyPositioned, PR_FALSE);
#if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame" #if 0 // XXX The following "ifdef" could has been moved to the method "InitializeScrollFrame"
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
@ -2566,7 +2564,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// The area frame becomes a container for child frames that are // The area frame becomes a container for child frames that are
// absolutely positioned // absolutely positioned
nsAbsoluteItems absoluteItems(scrolledFrame); nsAbsoluteItems absoluteItems(scrolledFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems, ProcessChildren(aPresContext, aContent, scrolledFrame, absoluteItems,
childItems); childItems);
@ -2598,24 +2596,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
isAbsolutelyPositioned = PR_TRUE; isAbsolutelyPositioned = PR_TRUE;
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, 0); NS_NewAreaFrame(newFrame, 0);
aNewFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock, newFrame->Init(*aPresContext, aContent, aAbsoluteItems.containingBlock,
aStyleContext); aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. The area frame becomes a container for child // Process the child content. The area frame becomes a container for child
// frames that are absolutely positioned // frames that are absolutely positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems);
ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
@ -2626,45 +2625,45 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
(NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) { (NS_STYLE_DISPLAY_LIST_ITEM == aDisplay->mDisplay))) {
// Create an area frame // Create an area frame
NS_NewAreaFrame(aNewFrame, NS_BLOCK_SHRINK_WRAP); NS_NewAreaFrame(newFrame, NS_BLOCK_SHRINK_WRAP);
// Initialize the frame // Initialize the frame
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view // See if we need to create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content // Process the child content
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
// See if it's a relatively positioned block // See if it's a relatively positioned block
} else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) && } else if ((NS_STYLE_POSITION_RELATIVE == position->mPosition) &&
((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) { ((NS_STYLE_DISPLAY_BLOCK == aDisplay->mDisplay))) {
// Create an area frame. No space manager, though // Create an area frame. No space manager, though
NS_NewAreaFrame(aNewFrame, NS_AREA_NO_SPACE_MGR); NS_NewAreaFrame(newFrame, NS_AREA_NO_SPACE_MGR);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext); newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Create a view // Create a view
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content. Relatively positioned frames becomes a // Process the child content. Relatively positioned frames becomes a
// container for child frames that are positioned // container for child frames that are positioned
nsAbsoluteItems absoluteItems(aNewFrame); nsAbsoluteItems absoluteItems(newFrame);
nsFrameItems childItems; nsFrameItems childItems;
ProcessChildren(aPresContext, aContent, aNewFrame, absoluteItems, childItems); ProcessChildren(aPresContext, aContent, newFrame, absoluteItems, childItems);
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (nsnull != absoluteItems.childList) { if (nsnull != absoluteItems.childList) {
aNewFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList, newFrame->SetInitialChildList(*aPresContext, nsLayoutAtoms::absoluteList,
absoluteItems.childList); absoluteItems.childList);
} }
} else { } else {
@ -2676,12 +2675,12 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_LIST_ITEM: case NS_STYLE_DISPLAY_LIST_ITEM:
case NS_STYLE_DISPLAY_RUN_IN: case NS_STYLE_DISPLAY_RUN_IN:
case NS_STYLE_DISPLAY_COMPACT: case NS_STYLE_DISPLAY_COMPACT:
rv = NS_NewBlockFrame(aNewFrame, 0); rv = NS_NewBlockFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_INLINE: case NS_STYLE_DISPLAY_INLINE:
rv = NS_NewInlineFrame(aNewFrame); rv = NS_NewInlineFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2691,25 +2690,25 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock : nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :
aParentFrame; aParentFrame;
rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext, rv = ConstructTableFrame(aPresContext, aContent, geometricParent, aStyleContext,
aAbsoluteItems, aNewFrame); aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
// Add the table frame to the list of items
aFrameItems.AddChild(aNewFrame);
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else {
// Add the table frame to the flow
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;
} }
@ -2726,7 +2725,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableRowGroupFrame(aNewFrame); rv = NS_NewTableRowGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2734,7 +2733,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_COLUMN: case NS_STYLE_DISPLAY_TABLE_COLUMN:
// XXX We should check for being inside of a table column group... // XXX We should check for being inside of a table column group...
rv = NS_NewTableColFrame(aNewFrame); rv = NS_NewTableColFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2745,7 +2744,7 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame); rv = GetAdjustedParentFrame(aParentFrame, aDisplay->mDisplay, parentFrame);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
rv = NS_NewTableColGroupFrame(aNewFrame); rv = NS_NewTableColGroupFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
} }
} }
@ -2753,22 +2752,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
case NS_STYLE_DISPLAY_TABLE_ROW: case NS_STYLE_DISPLAY_TABLE_ROW:
// XXX We should check for being inside of a table row group... // XXX We should check for being inside of a table row group...
rv = NS_NewTableRowFrame(aNewFrame); rv = NS_NewTableRowFrame(newFrame);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
case NS_STYLE_DISPLAY_TABLE_CELL: case NS_STYLE_DISPLAY_TABLE_CELL:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame, rv = ConstructTableCellFrame(aPresContext, aContent, aParentFrame,
aStyleContext, aAbsoluteItems, aNewFrame); aStyleContext, aAbsoluteItems, newFrame);
// Note: table construction function takes care of initializing the frame, // Note: table construction function takes care of initializing the frame,
// processing children, and setting the initial child list // processing children, and setting the initial child list
aFrameItems.AddChild(aNewFrame); aFrameItems.AddChild(newFrame);
return rv; return rv;
case NS_STYLE_DISPLAY_TABLE_CAPTION: case NS_STYLE_DISPLAY_TABLE_CAPTION:
// XXX We should check for being inside of a table row frame... // XXX We should check for being inside of a table row frame...
rv = NS_NewAreaFrame(aNewFrame, 0); rv = NS_NewAreaFrame(newFrame, 0);
processChildren = PR_TRUE; processChildren = PR_TRUE;
break; break;
@ -2779,26 +2778,22 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
// If we succeeded in creating a frame then initialize the frame and // If we succeeded in creating a frame then initialize the frame and
// process children if requested // process children if requested
if (NS_SUCCEEDED(rv) && (nsnull != aNewFrame)) { if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
newFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// Add the frame to the list of items.
aFrameItems.AddChild(aNewFrame);
aNewFrame->Init(*aPresContext, aContent, aParentFrame, aStyleContext);
// See if we need to create a view, e.g. the frame is absolutely positioned // See if we need to create a view, e.g. the frame is absolutely positioned
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, aNewFrame, nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,
aStyleContext, PR_FALSE); aStyleContext, PR_FALSE);
// Process the child content if requested // Process the child content if requested
nsFrameItems childItems; nsFrameItems childItems;
if (processChildren) { if (processChildren) {
rv = ProcessChildren(aPresContext, aContent, aNewFrame, aAbsoluteItems, rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,
childItems); childItems);
} }
// Set the frame's initial child list // Set the frame's initial child list
aNewFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList); newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
} }
} }
@ -2806,15 +2801,19 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
if (isAbsolutelyPositioned) { if (isAbsolutelyPositioned) {
nsIFrame* placeholderFrame; nsIFrame* placeholderFrame;
CreatePlaceholderFrameFor(aPresContext, aContent, aNewFrame, aStyleContext, CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,
aParentFrame, placeholderFrame); aParentFrame, placeholderFrame);
// Add the absolutely positioned frame to its containing block's list // Add the absolutely positioned frame to its containing block's list
// of child frames // of child frames
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame); aAbsoluteItems.AddAbsolutelyPositionedChild(newFrame);
// Add the placeholder frame to the flow // Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame); aFrameItems.AddChild(placeholderFrame);
} else if (nsnull != newFrame) {
// Add the frame we just created to the flowed list
aFrameItems.AddChild(newFrame);
} }
return rv; return rv;