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
Родитель 6b630ec451
Коммит c3c3f9d0be
3 изменённых файлов: 25 добавлений и 7 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -186,6 +186,7 @@ public:
HitTestState* aState); HitTestState* aState);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx, virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
NS_DISPLAY_DECL_NAME("FieldSetBorderBackground") NS_DISPLAY_DECL_NAME("FieldSetBorderBackground")
}; };
@ -198,6 +199,12 @@ nsIFrame* nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuil
return mFrame; return mFrame;
} }
nsRect
nsDisplayFieldSetBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder)
{
return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame);
}
void void
nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder, nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx, const nsRect& aDirtyRect) 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); 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, nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
aDirtyRect, rect, PR_TRUE); aDirtyRect, rect, PR_TRUE);