From 5a52cfb5d7eb4133185cb652003313d55217e647 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Fri, 22 Feb 2002 01:45:05 +0000 Subject: [PATCH] Get the rect of the PageContentFrame and using it. Also, painting BG after the container and only when we are suppose to be painting the BG Bug 126824 r=dcone sr=attinasi a=dbaron git-svn-id: svn://10.0.0.236/trunk@115188 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsPageFrame.cpp | 13 ++++++++----- mozilla/layout/html/base/src/nsPageFrame.cpp | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 8bd4ffc10b4..8d4b2469c2c 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -178,7 +178,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, aPresContext->GetShell(&presShell); presShell->GetStyleSet(&styleSet); NS_RELEASE(presShell); - styleSet->CreateContinuingFrame(aPresContext, prevLastChild, this, &newFrame); + styleSet->CreateContinuingFrame(aPresContext, prevLastChild, contentPage, &newFrame); NS_RELEASE(styleSet); contentPage->mFrames.SetFrames(newFrame); } @@ -654,7 +654,9 @@ nsPageFrame::Paint(nsIPresContext* aPresContext, } } - DrawBackground(aPresContext,aRenderingContext,aDirtyRect) ; + if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) { + DrawBackground(aPresContext,aRenderingContext,aDirtyRect); + } nsresult rv = nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); @@ -742,10 +744,11 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext, { nsSimplePageSequenceFrame* seqFrame = NS_STATIC_CAST(nsSimplePageSequenceFrame*, mParent); if (seqFrame != nsnull) { - nsRect rect = mPD->mReflowRect; - rect.Deflate(mPD->mReflowMargin); - rect.Deflate(mPD->mExtraMargin); + nsIFrame* pageContentFrame = mFrames.FirstChild(); + NS_ASSERTION(pageContentFrame, "Must always be there."); + nsRect rect; + pageContentFrame->GetRect(rect); const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*, mStyleContext->GetStyleData(eStyleStruct_Border)); diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 8bd4ffc10b4..8d4b2469c2c 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -178,7 +178,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext, aPresContext->GetShell(&presShell); presShell->GetStyleSet(&styleSet); NS_RELEASE(presShell); - styleSet->CreateContinuingFrame(aPresContext, prevLastChild, this, &newFrame); + styleSet->CreateContinuingFrame(aPresContext, prevLastChild, contentPage, &newFrame); NS_RELEASE(styleSet); contentPage->mFrames.SetFrames(newFrame); } @@ -654,7 +654,9 @@ nsPageFrame::Paint(nsIPresContext* aPresContext, } } - DrawBackground(aPresContext,aRenderingContext,aDirtyRect) ; + if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) { + DrawBackground(aPresContext,aRenderingContext,aDirtyRect); + } nsresult rv = nsContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); @@ -742,10 +744,11 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext, { nsSimplePageSequenceFrame* seqFrame = NS_STATIC_CAST(nsSimplePageSequenceFrame*, mParent); if (seqFrame != nsnull) { - nsRect rect = mPD->mReflowRect; - rect.Deflate(mPD->mReflowMargin); - rect.Deflate(mPD->mExtraMargin); + nsIFrame* pageContentFrame = mFrames.FirstChild(); + NS_ASSERTION(pageContentFrame, "Must always be there."); + nsRect rect; + pageContentFrame->GetRect(rect); const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*, mStyleContext->GetStyleData(eStyleStruct_Border));