Bug 456792 - Two more API cleanups for nsCSSRendering; patch 1; r+sr=roc

This commit is contained in:
Zack Weinberg 2008-09-25 17:53:27 +02:00
parent 8ba3c68ea9
commit 473726ed0c
9 changed files with 16 additions and 32 deletions

View File

@ -1266,7 +1266,6 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
PRBool isCanvas; PRBool isCanvas;
const nsStyleBackground *color; const nsStyleBackground *color;
const nsStylePadding* padding = aForFrame->GetStylePadding();
const nsStyleBorder* border = aForFrame->GetStyleBorder(); const nsStyleBorder* border = aForFrame->GetStyleBorder();
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) { if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) {
@ -1289,7 +1288,7 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
if (!isCanvas) { if (!isCanvas) {
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame, PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
aDirtyRect, aBorderArea, *color, *border, aDirtyRect, aBorderArea, *color, *border,
*padding, aUsePrintSettings, aBGClipRect); aUsePrintSettings, aBGClipRect);
return; return;
} }
@ -1319,7 +1318,7 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame, PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
aDirtyRect, aBorderArea, canvasColor, aDirtyRect, aBorderArea, canvasColor,
*border, *padding, aUsePrintSettings, aBGClipRect); *border, aUsePrintSettings, aBGClipRect);
} }
inline nscoord IntDivFloor(nscoord aDividend, nscoord aDivisor) inline nscoord IntDivFloor(nscoord aDividend, nscoord aDivisor)
@ -1437,7 +1436,6 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsStyleBackground& aColor, const nsStyleBackground& aColor,
const nsStyleBorder& aBorder, const nsStyleBorder& aBorder,
const nsStylePadding& aPadding,
PRBool aUsePrintSettings, PRBool aUsePrintSettings,
nsRect* aBGClipRect) nsRect* aBGClipRect)
{ {
@ -1502,7 +1500,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// if there is no background image or background images are turned off, try a color. // if there is no background image or background images are turned off, try a color.
if (!aColor.mBackgroundImage || !canDrawBackgroundImage) { if (!aColor.mBackgroundImage || !canDrawBackgroundImage) {
PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea, PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea,
aColor, aBorder, aPadding, canDrawBackgroundColor); aColor, aBorder, canDrawBackgroundColor);
return; return;
} }
@ -1518,7 +1516,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
if (!req || !(status & imgIRequest::STATUS_FRAME_COMPLETE) || !(status & imgIRequest::STATUS_SIZE_AVAILABLE)) { if (!req || !(status & imgIRequest::STATUS_FRAME_COMPLETE) || !(status & imgIRequest::STATUS_SIZE_AVAILABLE)) {
PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea, PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea,
aColor, aBorder, aPadding, canDrawBackgroundColor); aColor, aBorder, canDrawBackgroundColor);
return; return;
} }
@ -1623,7 +1621,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// The background color is rendered over the 'background-clip' area // The background color is rendered over the 'background-clip' area
if (needBackgroundColor) { if (needBackgroundColor) {
PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea, PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea,
aColor, aBorder, aPadding, canDrawBackgroundColor); aColor, aBorder, canDrawBackgroundColor);
} }
if ((tileWidth == 0) || (tileHeight == 0) || dirtyRect.IsEmpty()) { if ((tileWidth == 0) || (tileHeight == 0) || dirtyRect.IsEmpty()) {
@ -2317,7 +2315,6 @@ nsCSSRendering::PaintBackgroundColor(nsPresContext* aPresContext,
const nsRect& aBgClipArea, const nsRect& aBgClipArea,
const nsStyleBackground& aColor, const nsStyleBackground& aColor,
const nsStyleBorder& aBorder, const nsStyleBorder& aBorder,
const nsStylePadding& aPadding,
PRBool aCanPaintNonWhite) PRBool aCanPaintNonWhite)
{ {
// If we're only allowed to paint white, then don't bail out on transparent // If we're only allowed to paint white, then don't bail out on transparent

View File

@ -159,7 +159,6 @@ public:
const nsRect& aBorderArea, const nsRect& aBorderArea,
const nsStyleBackground& aColor, const nsStyleBackground& aColor,
const nsStyleBorder& aBorder, const nsStyleBorder& aBorder,
const nsStylePadding& aPadding,
PRBool aUsePrintSettings = PR_FALSE, PRBool aUsePrintSettings = PR_FALSE,
nsRect* aBGClipRect = nsnull); nsRect* aBGClipRect = nsnull);
@ -276,7 +275,6 @@ protected:
const nsRect& aBgClipArea, const nsRect& aBgClipArea,
const nsStyleBackground& aColor, const nsStyleBackground& aColor,
const nsStyleBorder& aBorder, const nsStyleBorder& aBorder,
const nsStylePadding& aPadding,
PRBool aCanPaintNonWhite); PRBool aCanPaintNonWhite);
static void PaintRoundedBackground(nsPresContext* aPresContext, static void PaintRoundedBackground(nsPresContext* aPresContext,

View File

@ -250,7 +250,6 @@ nsGfxCheckboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void void
nsGfxCheckboxControlFrame::PaintCheckBoxFromStyle( nsGfxCheckboxControlFrame::PaintCheckBoxFromStyle(
nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) {
const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition(); const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition();
const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder();
const nsStyleBackground* myBackground = mCheckButtonFaceStyle->GetStyleBackground(); const nsStyleBackground* myBackground = mCheckButtonFaceStyle->GetStyleBackground();
@ -267,7 +266,7 @@ nsGfxCheckboxControlFrame::PaintCheckBoxFromStyle(
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext,
this, aDirtyRect, rect, *myBackground, this, aDirtyRect, rect, *myBackground,
*myBorder, *myPadding, PR_FALSE); *myBorder, PR_FALSE);
nsCSSRendering::PaintBorder(PresContext(), aRenderingContext, this, nsCSSRendering::PaintBorder(PresContext(), aRenderingContext, this,
aDirtyRect, rect, *myBorder, aDirtyRect, rect, *myBorder,
mCheckButtonFaceStyle); mCheckButtonFaceStyle);

View File

@ -130,7 +130,6 @@ nsGfxRadioControlFrame::PaintRadioButtonFromStyle(
// Paint the button for the radio button using CSS background rendering code // Paint the button for the radio button using CSS background rendering code
const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground(); const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground();
const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor(); const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor();
const nsStylePadding* myPadding = mRadioButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition(); const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition();
NS_ASSERTION(myPosition->mWidth.GetUnit() == eStyleUnit_Coord && NS_ASSERTION(myPosition->mWidth.GetUnit() == eStyleUnit_Coord &&
@ -154,7 +153,7 @@ nsGfxRadioControlFrame::PaintRadioButtonFromStyle(
nsPresContext* pc = PresContext(); nsPresContext* pc = PresContext();
nsCSSRendering::PaintBackgroundWithSC(pc, aRenderingContext, nsCSSRendering::PaintBackgroundWithSC(pc, aRenderingContext,
this, aDirtyRect, rect, this, aDirtyRect, rect,
tmpColor, *myBorder, *myPadding, PR_FALSE); tmpColor, *myBorder, PR_FALSE);
nsCSSRendering::PaintBorder(pc, aRenderingContext, this, nsCSSRendering::PaintBorder(pc, aRenderingContext, this,
aDirtyRect, rect, *myBorder, mRadioButtonFaceStyle, 0); aDirtyRect, rect, *myBorder, mRadioButtonFaceStyle, 0);
} }

View File

@ -1930,12 +1930,10 @@ void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx, const nsRect& aDirtyRect) nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
{ {
const nsStyleBorder* border = mStyleContext->GetStyleBorder(); const nsStyleBorder* border = mStyleContext->GetStyleBorder();
const nsStylePadding* padding = mStyleContext->GetStylePadding();
const nsStyleBackground* backg = mStyleContext->GetStyleBackground(); const nsStyleBackground* backg = mStyleContext->GetStyleBackground();
nsRect rect(mRect + aBuilder->ToReferenceFrame(mFrame));
nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame, nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
aDirtyRect, aDirtyRect, rect, *backg, *border,
mRect + aBuilder->ToReferenceFrame(mFrame),
*backg, *border, *padding,
PR_TRUE); PR_TRUE);
} }

View File

@ -1206,5 +1206,5 @@ nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this, nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
aDirtyRect, rect, aDirtyRect, rect,
*GetStyleBackground(), myBorder, *GetStyleBackground(), myBorder,
*GetStylePadding(), PR_TRUE, nsnull); PR_TRUE, nsnull);
} }

View File

@ -240,8 +240,6 @@ TableBackgroundPainter::TableBackgroundPainter(nsTableFrame* aTableFrame,
mZeroBorder.SetBorderWidth(side, 0); mZeroBorder.SetBorderWidth(side, 0);
} }
mZeroPadding.RecalcData();
mIsBorderCollapse = aTableFrame->IsBorderCollapse(); mIsBorderCollapse = aTableFrame->IsBorderCollapse();
#ifdef DEBUG #ifdef DEBUG
mCompatMode = mPresContext->CompatibilityMode(); mCompatMode = mPresContext->CompatibilityMode();
@ -320,7 +318,7 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
tableData.mRect + mRenderPt, tableData.mRect + mRenderPt,
*tableData.mBackground, *tableData.mBackground,
*tableData.mBorder, *tableData.mBorder,
mZeroPadding, PR_TRUE); PR_TRUE);
} }
tableData.Destroy(mPresContext); tableData.Destroy(mPresContext);
return NS_OK; return NS_OK;
@ -625,7 +623,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
mCols[colIndex].mColGroup->mRect + mRenderPt, mCols[colIndex].mColGroup->mRect + mRenderPt,
*mCols[colIndex].mColGroup->mBackground, *mCols[colIndex].mColGroup->mBackground,
*mCols[colIndex].mColGroup->mBorder, *mCols[colIndex].mColGroup->mBorder,
mZeroPadding, PR_TRUE, &mCellRect); PR_TRUE, &mCellRect);
} }
//Paint column background //Paint column background
@ -635,7 +633,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
mCols[colIndex].mCol.mRect + mRenderPt, mCols[colIndex].mCol.mRect + mRenderPt,
*mCols[colIndex].mCol.mBackground, *mCols[colIndex].mCol.mBackground,
*mCols[colIndex].mCol.mBorder, *mCols[colIndex].mCol.mBorder,
mZeroPadding, PR_TRUE, &mCellRect); PR_TRUE, &mCellRect);
} }
//Paint row group background //Paint row group background
@ -644,7 +642,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
mRowGroup.mFrame, mDirtyRect, mRowGroup.mFrame, mDirtyRect,
mRowGroup.mRect + mRenderPt, mRowGroup.mRect + mRenderPt,
*mRowGroup.mBackground, *mRowGroup.mBorder, *mRowGroup.mBackground, *mRowGroup.mBorder,
mZeroPadding, PR_TRUE, &mCellRect); PR_TRUE, &mCellRect);
} }
//Paint row background //Paint row background
@ -653,7 +651,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
mRow.mFrame, mDirtyRect, mRow.mFrame, mDirtyRect,
mRow.mRect + mRenderPt, mRow.mRect + mRenderPt,
*mRow.mBackground, *mRow.mBorder, *mRow.mBackground, *mRow.mBorder,
mZeroPadding, PR_TRUE, &mCellRect); PR_TRUE, &mCellRect);
} }
//Paint cell background in border-collapse unless we're just passing //Paint cell background in border-collapse unless we're just passing

View File

@ -241,10 +241,7 @@ class TableBackgroundPainter
TableBackgroundData mRow; //current row TableBackgroundData mRow; //current row
nsRect mCellRect; //current cell's rect nsRect mCellRect; //current cell's rect
nsStyleBorder mZeroBorder; //cached zero-width border nsStyleBorder mZeroBorder; //cached zero-width border
nsStylePadding mZeroPadding; //cached zero-width padding
}; };
#endif #endif

View File

@ -3842,13 +3842,11 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
{ {
const nsStyleBackground* myColor = aStyleContext->GetStyleBackground(); const nsStyleBackground* myColor = aStyleContext->GetStyleBackground();
const nsStyleBorder* myBorder = aStyleContext->GetStyleBorder(); const nsStyleBorder* myBorder = aStyleContext->GetStyleBorder();
const nsStylePadding* myPadding = aStyleContext->GetStylePadding();
const nsStyleOutline* myOutline = aStyleContext->GetStyleOutline(); const nsStyleOutline* myOutline = aStyleContext->GetStyleOutline();
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext, nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
this, aDirtyRect, aRect, this, aDirtyRect, aRect,
*myColor, *myBorder, *myPadding, *myColor, *myBorder, PR_TRUE);
PR_TRUE);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
aDirtyRect, aRect, *myBorder, mStyleContext); aDirtyRect, aRect, *myBorder, mStyleContext);