Bug 475197. -moz-box-shadow needs to be hooked up to buttons and fieldsets since they have custom background painting code. r+sr=roc

This commit is contained in:
Michael Ventnor 2009-01-28 22:28:14 +13:00
parent 6b630ec451
commit c3c3f9d0be
3 changed files with 25 additions and 7 deletions

View File

@ -1056,14 +1056,13 @@ nsCSSRendering::PaintBoxShadow(nsPresContext* aPresContext,
const nsPoint& aForFramePt,
const nsRect& aDirtyRect)
{
nsMargin borderValues;
PRIntn sidesToSkip;
nsRect frameRect;
const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
borderValues = styleBorder->GetActualBorder();
sidesToSkip = aForFrame->GetSkipSides();
frameRect = nsRect(aForFramePt, aForFrame->GetSize());
if (!styleBorder->mBoxShadow)
return;
nsMargin borderValues = styleBorder->GetActualBorder();
PRIntn sidesToSkip = aForFrame->GetSkipSides();
nsRect frameRect = nsRect(aForFramePt, aForFrame->GetSize());
// Get any border radius, since box-shadow must also have rounded corners if the frame does
nscoord twipsRadii[8];

View File

@ -109,6 +109,7 @@ public:
}
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
NS_DISPLAY_DECL_NAME("ButtonBorderBackground")
private:
nsButtonFrameRenderer* mBFR;
@ -133,6 +134,11 @@ private:
nsButtonFrameRenderer* mBFR;
};
nsRect nsDisplayButtonBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder)
{
return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
}
void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx,
const nsRect& aDirtyRect)
@ -224,6 +230,9 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
const nsStyleBorder* border = context->GetStyleBorder();
nsCSSRendering::PaintBoxShadow(aPresContext, aRenderingContext, mFrame,
aRect.TopLeft(), aDirtyRect);
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
aDirtyRect, buttonRect, PR_FALSE);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,

View File

@ -186,6 +186,7 @@ public:
HitTestState* aState);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
NS_DISPLAY_DECL_NAME("FieldSetBorderBackground")
};
@ -198,6 +199,12 @@ nsIFrame* nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuil
return mFrame;
}
nsRect
nsDisplayFieldSetBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder)
{
return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
}
void
nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx, const nsRect& aDirtyRect)
@ -272,6 +279,9 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
nsCSSRendering::PaintBoxShadow(presContext, aRenderingContext, this,
rect.TopLeft(), aDirtyRect);
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
aDirtyRect, rect, PR_TRUE);