From fc9bf2dc32008309fa54faa817e34ac5d5035a67 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sat, 17 Jul 1999 00:49:54 +0000 Subject: [PATCH] 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 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 62 +++++++++---------- .../html/style/src/nsCSSFrameConstructor.cpp | 62 +++++++++---------- 2 files changed, 58 insertions(+), 66 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index c995ea4a316..5c79226e61c 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -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; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index c995ea4a316..5c79226e61c 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -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;