Bug 456152 - slight API cleanup for nsCSSRendering::PaintBackground; r+sr=roc
This commit is contained in:
@@ -1258,8 +1258,6 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
nsIFrame* aForFrame,
|
nsIFrame* aForFrame,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsRect& aBorderArea,
|
const nsRect& aBorderArea,
|
||||||
const nsStyleBorder& aBorder,
|
|
||||||
const nsStylePadding& aPadding,
|
|
||||||
PRBool aUsePrintSettings,
|
PRBool aUsePrintSettings,
|
||||||
nsRect* aBGClipRect)
|
nsRect* aBGClipRect)
|
||||||
{
|
{
|
||||||
@@ -1268,6 +1266,8 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
PRBool isCanvas;
|
PRBool isCanvas;
|
||||||
const nsStyleBackground *color;
|
const nsStyleBackground *color;
|
||||||
|
const nsStylePadding* padding = aForFrame->GetStylePadding();
|
||||||
|
const nsStyleBorder* border = aForFrame->GetStyleBorder();
|
||||||
|
|
||||||
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) {
|
if (!FindBackground(aPresContext, aForFrame, &color, &isCanvas)) {
|
||||||
// we don't want to bail out of moz-appearance is set on a root
|
// we don't want to bail out of moz-appearance is set on a root
|
||||||
@@ -1288,8 +1288,8 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
if (!isCanvas) {
|
if (!isCanvas) {
|
||||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||||
aDirtyRect, aBorderArea, *color, aBorder,
|
aDirtyRect, aBorderArea, *color, *border,
|
||||||
aPadding, aUsePrintSettings, aBGClipRect);
|
*padding, aUsePrintSettings, aBGClipRect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,7 +1319,7 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
|
||||||
aDirtyRect, aBorderArea, canvasColor,
|
aDirtyRect, aBorderArea, canvasColor,
|
||||||
aBorder, aPadding, aUsePrintSettings, aBGClipRect);
|
*border, *padding, aUsePrintSettings, aBGClipRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline nscoord IntDivFloor(nscoord aDividend, nscoord aDivisor)
|
inline nscoord IntDivFloor(nscoord aDividend, nscoord aDivisor)
|
||||||
|
|||||||
@@ -144,14 +144,12 @@ public:
|
|||||||
nsIFrame* aForFrame,
|
nsIFrame* aForFrame,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsRect& aBorderArea,
|
const nsRect& aBorderArea,
|
||||||
const nsStyleBorder& aBorder,
|
|
||||||
const nsStylePadding& aPadding,
|
|
||||||
PRBool aUsePrintSettings,
|
PRBool aUsePrintSettings,
|
||||||
nsRect* aBGClipRect = nsnull);
|
nsRect* aBGClipRect = nsnull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as |PaintBackground|, except using the provided style context
|
* Same as |PaintBackground|, except using the provided style structs.
|
||||||
* (which short-circuits the code that ensures that the root element's
|
* This short-circuits the code that ensures that the root element's
|
||||||
* background is drawn on the canvas.
|
* background is drawn on the canvas.
|
||||||
*/
|
*/
|
||||||
static void PaintBackgroundWithSC(nsPresContext* aPresContext,
|
static void PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||||
|
|||||||
@@ -555,8 +555,6 @@ nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
|
nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
|
||||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||||
aDirtyRect, nsRect(offset, mFrame->GetSize()),
|
aDirtyRect, nsRect(offset, mFrame->GetSize()),
|
||||||
*mFrame->GetStyleBorder(),
|
|
||||||
*mFrame->GetStylePadding(),
|
|
||||||
mFrame->HonorPrintBackgroundSettings());
|
mFrame->HonorPrintBackgroundSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,11 +223,9 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
|
|||||||
nsStyleContext* context = mFrame->GetStyleContext();
|
nsStyleContext* context = mFrame->GetStyleContext();
|
||||||
|
|
||||||
const nsStyleBorder* border = context->GetStyleBorder();
|
const nsStyleBorder* border = context->GetStyleBorder();
|
||||||
const nsStylePadding* padding = context->GetStylePadding();
|
|
||||||
|
|
||||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||||
aDirtyRect, buttonRect, *border, *padding,
|
aDirtyRect, buttonRect, PR_FALSE);
|
||||||
PR_FALSE);
|
|
||||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||||
aDirtyRect, buttonRect, *border, context);
|
aDirtyRect, buttonRect, *border, context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,6 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
{
|
{
|
||||||
PRIntn skipSides = GetSkipSides();
|
PRIntn skipSides = GetSkipSides();
|
||||||
const nsStyleBorder* borderStyle = GetStyleBorder();
|
const nsStyleBorder* borderStyle = GetStyleBorder();
|
||||||
const nsStylePadding* paddingStyle = GetStylePadding();
|
|
||||||
|
|
||||||
nscoord topBorder = borderStyle->GetActualBorderWidth(NS_SIDE_TOP);
|
nscoord topBorder = borderStyle->GetActualBorderWidth(NS_SIDE_TOP);
|
||||||
nscoord yoff = 0;
|
nscoord yoff = 0;
|
||||||
@@ -274,8 +273,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
|
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
|
||||||
|
|
||||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||||
aDirtyRect, rect, *borderStyle,
|
aDirtyRect, rect, PR_TRUE);
|
||||||
*paddingStyle, PR_TRUE);
|
|
||||||
|
|
||||||
if (mLegendFrame) {
|
if (mLegendFrame) {
|
||||||
|
|
||||||
|
|||||||
@@ -440,11 +440,11 @@ public:
|
|||||||
CanvasFrame* frame = static_cast<CanvasFrame*>(mFrame);
|
CanvasFrame* frame = static_cast<CanvasFrame*>(mFrame);
|
||||||
nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
|
nsPoint offset = aBuilder->ToReferenceFrame(mFrame);
|
||||||
nsRect bgClipRect = frame->CanvasArea() + offset;
|
nsRect bgClipRect = frame->CanvasArea() + offset;
|
||||||
|
// XXXzw This is the only use of the bgClipRect argument. Does this
|
||||||
|
// path need the propagation-of-root-background-to-viewport logic?
|
||||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||||
aDirtyRect,
|
aDirtyRect,
|
||||||
nsRect(offset, mFrame->GetSize()),
|
nsRect(offset, mFrame->GetSize()),
|
||||||
*mFrame->GetStyleBorder(),
|
|
||||||
*mFrame->GetStylePadding(),
|
|
||||||
mFrame->HonorPrintBackgroundSettings(),
|
mFrame->HonorPrintBackgroundSettings(),
|
||||||
&bgClipRect);
|
&bgClipRect);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -571,12 +571,9 @@ nsPageFrame::PaintPageContent(nsIRenderingContext& aRenderingContext,
|
|||||||
}
|
}
|
||||||
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
||||||
|
|
||||||
const nsStyleBorder* border = GetStyleBorder();
|
|
||||||
const nsStylePadding* padding = GetStylePadding();
|
|
||||||
nsRect backgroundRect = nsRect(nsPoint(0, 0), pageContentFrame->GetSize());
|
nsRect backgroundRect = nsRect(nsPoint(0, 0), pageContentFrame->GetSize());
|
||||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||||
rect, backgroundRect, *border, *padding,
|
rect, backgroundRect, PR_TRUE);
|
||||||
PR_TRUE);
|
|
||||||
|
|
||||||
nsLayoutUtils::PaintFrame(&aRenderingContext, pageContentFrame,
|
nsLayoutUtils::PaintFrame(&aRenderingContext, pageContentFrame,
|
||||||
nsRegion(rect), NS_RGBA(0,0,0,0));
|
nsRegion(rect), NS_RGBA(0,0,0,0));
|
||||||
|
|||||||
@@ -2052,11 +2052,8 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
|
|||||||
nsDisplayMathMLCharBackground(aForFrame, mRect, styleContext));
|
nsDisplayMathMLCharBackground(aForFrame, mRect, styleContext));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
//else
|
//else
|
||||||
// our container frame will take care of painting its background
|
// our container frame will take care of painting its background
|
||||||
// nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, aForFrame,
|
|
||||||
// aDirtyRect, rect, *border, *padding, PR_TRUE);
|
|
||||||
|
|
||||||
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||||
// for visual debug
|
// for visual debug
|
||||||
|
|||||||
@@ -345,8 +345,7 @@ nsTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
{
|
{
|
||||||
nsRect rect(aPt, GetSize());
|
nsRect rect(aPt, GetSize());
|
||||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
||||||
aDirtyRect, rect, *GetStyleBorder(),
|
aDirtyRect, rect, PR_TRUE);
|
||||||
*GetStylePadding(), PR_TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by nsTablePainter
|
// Called by nsTablePainter
|
||||||
@@ -1202,7 +1201,10 @@ nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsRect rect(aPt, GetSize());
|
nsRect rect(aPt, GetSize());
|
||||||
nsCSSRendering::PaintBackground(PresContext(), aRenderingContext, this,
|
// bypassing nsCSSRendering::PaintBackground is safe because this kind
|
||||||
aDirtyRect, rect, myBorder, *GetStylePadding(),
|
// of frame cannot be used for the root element
|
||||||
PR_TRUE);
|
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
|
||||||
|
aDirtyRect, rect,
|
||||||
|
*GetStyleBackground(), myBorder,
|
||||||
|
*GetStylePadding(), PR_TRUE, nsnull);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
nsPoint aPt, const nsRect& aDirtyRect) {
|
nsPoint aPt, const nsRect& aDirtyRect) {
|
||||||
PRIntn skipSides = 0;
|
PRIntn skipSides = 0;
|
||||||
const nsStyleBorder* borderStyleData = GetStyleBorder();
|
const nsStyleBorder* borderStyleData = GetStyleBorder();
|
||||||
const nsStylePadding* paddingStyleData = GetStylePadding();
|
|
||||||
const nsMargin& border = borderStyleData->GetActualBorder();
|
const nsMargin& border = borderStyleData->GetActualBorder();
|
||||||
nscoord yoff = 0;
|
nscoord yoff = 0;
|
||||||
nsPresContext* presContext = PresContext();
|
nsPresContext* presContext = PresContext();
|
||||||
@@ -174,8 +173,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
|
|||||||
groupRect += aPt;
|
groupRect += aPt;
|
||||||
|
|
||||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||||
aDirtyRect, rect, *borderStyleData,
|
aDirtyRect, rect, PR_FALSE);
|
||||||
*paddingStyleData, PR_FALSE);
|
|
||||||
|
|
||||||
if (groupBox) {
|
if (groupBox) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user