From 7f83027391bd2ecb771c67032c2c727ee18ef5bd Mon Sep 17 00:00:00 2001 From: "attinasi%netscape.com" Date: Mon, 31 Jan 2000 14:04:41 +0000 Subject: [PATCH] Changed the setting of PrimaryFrame for elements wrapped in a GfxScrollFrame, except for the DocElement which still has the primary frame set to the scrolledframe. Fixed compiler warning around NS_NewFiedlSetFrame(...). r=evaughan b=23803 git-svn-id: svn://10.0.0.236/trunk@59248 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 18 ++++++++++++------ .../html/style/src/nsCSSFrameConstructor.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 075040d6bb5..f3e8264c94a 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -2299,8 +2299,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, aParentFrame, contentFrame, styleContext); - - aNewFrame = scrollFrame; + // primary is set above (to the contentFrame) + + aNewFrame = scrollFrame; } else { // if not scrollable the new frame is the content frame. aNewFrame = contentFrame; @@ -2605,6 +2606,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell, parentFrame, rootFrame, rootPseudoStyle); + + // set the primary frame to the root frame + state.mFrameManager->SetPrimaryFrameFor(aDocElement, rootFrame); } if (isPaginated) { @@ -3307,7 +3311,9 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShell, nsIFrame * newFrame; PRUint32 flags = aIsAbsolutelyPositioned ? NS_BLOCK_SPACE_MGR : 0; nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, flags); - + if (!NS_SUCCEEDED(rv) { + return rv; + } nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); @@ -4500,9 +4506,6 @@ nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIPresContext* aPresConte // the the scroll frames child list aScrollFrame->SetInitialChildList(aPresContext, nsnull, aScrolledFrame); - if (aContent != nsnull) - aState.mFrameManager->SetPrimaryFrameFor(aContent, aScrolledFrame); - return NS_OK; } @@ -4599,6 +4602,9 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell, aScrolledContentStyle = scrolledContentStyle; + // now set the primary frame to the ScrollFrame + aState.mFrameManager->SetPrimaryFrameFor( aContent, aNewFrame ); + return NS_OK; } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 075040d6bb5..f3e8264c94a 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -2299,8 +2299,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, aParentFrame, contentFrame, styleContext); - - aNewFrame = scrollFrame; + // primary is set above (to the contentFrame) + + aNewFrame = scrollFrame; } else { // if not scrollable the new frame is the content frame. aNewFrame = contentFrame; @@ -2605,6 +2606,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell, parentFrame, rootFrame, rootPseudoStyle); + + // set the primary frame to the root frame + state.mFrameManager->SetPrimaryFrameFor(aDocElement, rootFrame); } if (isPaginated) { @@ -3307,7 +3311,9 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShell, nsIFrame * newFrame; PRUint32 flags = aIsAbsolutelyPositioned ? NS_BLOCK_SPACE_MGR : 0; nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, flags); - + if (!NS_SUCCEEDED(rv) { + return rv; + } nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); @@ -4500,9 +4506,6 @@ nsCSSFrameConstructor::FinishBuildingScrollFrame(nsIPresContext* aPresConte // the the scroll frames child list aScrollFrame->SetInitialChildList(aPresContext, nsnull, aScrolledFrame); - if (aContent != nsnull) - aState.mFrameManager->SetPrimaryFrameFor(aContent, aScrolledFrame); - return NS_OK; } @@ -4599,6 +4602,9 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell, aScrolledContentStyle = scrolledContentStyle; + // now set the primary frame to the ScrollFrame + aState.mFrameManager->SetPrimaryFrameFor( aContent, aNewFrame ); + return NS_OK; }