Clean up in InitializeScrollFrame() to make sure floated and positioned elements

have their parent frame pointer set correctly


git-svn-id: svn://10.0.0.236/trunk@39800 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
troy%netscape.com
1999-07-17 00:49:54 +00:00
parent e225185627
commit fc9bf2dc32
2 changed files with 58 additions and 66 deletions

View File

@@ -3236,43 +3236,39 @@ nsCSSFrameConstructor::InitializeScrollFrame(nsIPresContext* aPresConte
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, scrolledFrame,
scrolledPseudoStyle, PR_TRUE);
// The area frame is a floater container
nsFrameConstructorSaveState floaterSaveState;
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState);
// Process children
nsAbsoluteItems floaterList(scrolledFrame);
if (aIsAbsolutelyPositioned || aIsFixedPositioned) {
nsFrameConstructorSaveState absoluteSaveState;
nsFrameItems childItems;
PRBool isPositionedContainingBlock = aIsAbsolutelyPositioned ||
aIsFixedPositioned;
if (isPositionedContainingBlock) {
// The area frame becomes a container for child frames that are
// absolutely positioned
nsAbsoluteItems absoluteItems(scrolledFrame);
nsFrameItems childItems;
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull,
childItems.childList);
if (nsnull != absoluteItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::absoluteList,
absoluteItems.childList);
}
if (floaterList.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
floaterList.childList);
}
} else {
nsFrameItems childItems;
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull,
childItems.childList);
if (floaterList.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
floaterList.childList);
}
aState.PushAbsoluteContainingBlock(scrolledFrame, absoluteSaveState);
}
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the scrolled frame's initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (isPositionedContainingBlock && aState.mAbsoluteItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::absoluteList,
aState.mAbsoluteItems.childList);
}
if (aState.mFloatedItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
aState.mFloatedItems.childList);
}
// Set the scroll frame's initial child list
scrollFrame->SetInitialChildList(*aPresContext, nsnull, scrolledFrame);
aNewFrame = scrollFrame;

View File

@@ -3236,43 +3236,39 @@ nsCSSFrameConstructor::InitializeScrollFrame(nsIPresContext* aPresConte
nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, scrolledFrame,
scrolledPseudoStyle, PR_TRUE);
// The area frame is a floater container
nsFrameConstructorSaveState floaterSaveState;
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState);
// Process children
nsAbsoluteItems floaterList(scrolledFrame);
if (aIsAbsolutelyPositioned || aIsFixedPositioned) {
nsFrameConstructorSaveState absoluteSaveState;
nsFrameItems childItems;
PRBool isPositionedContainingBlock = aIsAbsolutelyPositioned ||
aIsFixedPositioned;
if (isPositionedContainingBlock) {
// The area frame becomes a container for child frames that are
// absolutely positioned
nsAbsoluteItems absoluteItems(scrolledFrame);
nsFrameItems childItems;
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull,
childItems.childList);
if (nsnull != absoluteItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::absoluteList,
absoluteItems.childList);
}
if (floaterList.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
floaterList.childList);
}
} else {
nsFrameItems childItems;
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull,
childItems.childList);
if (floaterList.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
floaterList.childList);
}
aState.PushAbsoluteContainingBlock(scrolledFrame, absoluteSaveState);
}
ProcessChildren(aPresContext, aState, aContent, scrolledFrame, PR_FALSE,
childItems);
// Set the scrolled frame's initial child lists
scrolledFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);
if (isPositionedContainingBlock && aState.mAbsoluteItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::absoluteList,
aState.mAbsoluteItems.childList);
}
if (aState.mFloatedItems.childList) {
scrolledFrame->SetInitialChildList(*aPresContext,
nsLayoutAtoms::floaterList,
aState.mFloatedItems.childList);
}
// Set the scroll frame's initial child list
scrollFrame->SetInitialChildList(*aPresContext, nsnull, scrolledFrame);
aNewFrame = scrollFrame;