bug=96870 Add methods onto the nsIPresContext for setting and getting the background painting

boolean so printing can turn on and off backgrounds.  r=peterl sr=attinasi
This commit is contained in:
dcone%netscape.com 2001-12-11 05:57:37 +00:00
parent a1a76076a7
commit 6c7808bbc0
10 changed files with 37 additions and 6 deletions

View File

@ -2354,12 +2354,12 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
// if we are printing, bail for now
nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
if (thePrinterContext) {
PRBool canDrawBackground;
aPresContext->GetBackgroundDraw(canDrawBackground);
if(!canDrawBackground){
return;
}
// if there is no background image, try a color.
if (aColor.mBackgroundImage.IsEmpty()) {
// See if there's a background color specified. The background color

View File

@ -152,6 +152,8 @@ nsPresContext::nsPresContext()
mImageAnimationMode = imgIContainer::kNormalAnimMode;
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
SetBackgroundDraw(PR_TRUE); // always draw the background
mStopped = PR_FALSE;
mStopChrome = PR_TRUE;

View File

@ -508,6 +508,13 @@ public:
* Get the document charset
*/
NS_IMETHOD GetBidiCharset(nsAWritableString &aCharSet) = 0;
/**
* Set and get methods for controling the background drawing
*/
NS_IMETHOD GetBackgroundDraw(PRBool &aCanDraw)=0;
NS_IMETHOD SetBackgroundDraw(PRBool aCanDraw)=0;
#endif // IBMBIDI
/**

View File

@ -508,6 +508,13 @@ public:
* Get the document charset
*/
NS_IMETHOD GetBidiCharset(nsAWritableString &aCharSet) = 0;
/**
* Set and get methods for controling the background drawing
*/
NS_IMETHOD GetBackgroundDraw(PRBool &aCanDraw)=0;
NS_IMETHOD SetBackgroundDraw(PRBool aCanDraw)=0;
#endif // IBMBIDI
/**

View File

@ -508,6 +508,13 @@ public:
* Get the document charset
*/
NS_IMETHOD GetBidiCharset(nsAWritableString &aCharSet) = 0;
/**
* Set and get methods for controling the background drawing
*/
NS_IMETHOD GetBackgroundDraw(PRBool &aCanDraw)=0;
NS_IMETHOD SetBackgroundDraw(PRBool aCanDraw)=0;
#endif // IBMBIDI
/**

View File

@ -152,6 +152,8 @@ nsPresContext::nsPresContext()
mImageAnimationMode = imgIContainer::kNormalAnimMode;
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
SetBackgroundDraw(PR_TRUE); // always draw the background
mStopped = PR_FALSE;
mStopChrome = PR_TRUE;

View File

@ -167,6 +167,9 @@ public:
NS_IMETHOD SetIsRenderingOnlySelection(PRBool aVal) { mIsRenderingOnlySelection = aVal; return NS_OK; }
NS_IMETHOD IsRenderingOnlySelection(PRBool* aResult);
NS_IMETHOD GetBackgroundDraw(PRBool &aCanDraw) { aCanDraw = mDrawBackground; return NS_OK; }
NS_IMETHOD SetBackgroundDraw(PRBool aCanDraw) { mDrawBackground = aCanDraw; return NS_OK; }
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame);
NS_IMETHOD PaintCount(const char * aName, nsIRenderingContext* aRenderingContext, nsIFrame * aFrame, PRUint32 aColor);
@ -244,6 +247,7 @@ protected:
nscoord mDefaultBackgroundImageOffsetX;
nscoord mDefaultBackgroundImageOffsetY;
PRUint8 mDefaultBackgroundImageAttachment;
PRBool mDrawBackground;
nsSupportsHashtable mImageLoaders;

View File

@ -71,6 +71,7 @@ protected:
PrintContext::PrintContext() :
mPageDim(0,0,0,0)
{
SetBackgroundDraw(PR_FALSE);
}
PrintContext::~PrintContext()

View File

@ -76,6 +76,7 @@ PrintPreviewContext::PrintPreviewContext() :
mPageDim(-1,-1,-1,-1),
mCanPaginatedScroll(PR_TRUE)
{
SetBackgroundDraw(PR_FALSE);
}
PrintPreviewContext::~PrintPreviewContext()

View File

@ -2354,12 +2354,12 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
// if we are printing, bail for now
nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
if (thePrinterContext) {
PRBool canDrawBackground;
aPresContext->GetBackgroundDraw(canDrawBackground);
if(!canDrawBackground){
return;
}
// if there is no background image, try a color.
if (aColor.mBackgroundImage.IsEmpty()) {
// See if there's a background color specified. The background color