Bug 476062. Don't suppress box-shadows on elements with -moz-appearance in chrome documents. r+sr=dbaron

This commit is contained in:
Robert O'Callahan 2009-04-06 11:35:53 +12:00
parent 70159762f5
commit 6da50998ea
3 changed files with 28 additions and 12 deletions

View File

@ -1101,10 +1101,10 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
const nsRect& aFrameArea,
const nsRect& aDirtyRect)
{
const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
if (!styleBorder->mBoxShadow || aForFrame->IsThemed())
nsCSSShadowArray* shadows = aForFrame->GetEffectiveBoxShadows();
if (!shadows)
return;
const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
PRIntn sidesToSkip = aForFrame->GetSkipSides();
// Get any border radius, since box-shadow must also have rounded corners if the frame does
@ -1121,8 +1121,8 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
frameGfxRect.Round();
gfxRect dirtyGfxRect = RectToGfxRect(aDirtyRect, twipsPerPixel);
for (PRUint32 i = styleBorder->mBoxShadow->Length(); i > 0; --i) {
nsCSSShadowItem* shadowItem = styleBorder->mBoxShadow->ShadowAt(i - 1);
for (PRUint32 i = shadows->Length(); i > 0; --i) {
nsCSSShadowItem* shadowItem = shadows->ShadowAt(i - 1);
if (shadowItem->mInset)
continue;
@ -1196,9 +1196,10 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
const nsRect& aFrameArea,
const nsRect& aDirtyRect)
{
const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
if (!styleBorder->mBoxShadow || aForFrame->IsThemed())
nsCSSShadowArray* shadows = aForFrame->GetEffectiveBoxShadows();
if (!shadows)
return;
const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
// Get any border radius, since box-shadow must also have rounded corners if the frame does
nscoord twipsRadii[8];
@ -1230,8 +1231,8 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
frameGfxRect.Round();
gfxRect dirtyGfxRect = RectToGfxRect(aDirtyRect, twipsPerPixel);
for (PRUint32 i = styleBorder->mBoxShadow->Length(); i > 0; --i) {
nsCSSShadowItem* shadowItem = styleBorder->mBoxShadow->ShadowAt(i - 1);
for (PRUint32 i = shadows->Length(); i > 0; --i) {
nsCSSShadowItem* shadowItem = shadows->ShadowAt(i - 1);
if (!shadowItem->mInset)
continue;

View File

@ -739,6 +739,17 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex,
NS_PRECONDITION(aIndex >= 0, "invalid index number");
}
nsCSSShadowArray*
nsIFrame::GetEffectiveBoxShadows()
{
nsCSSShadowArray* shadows = GetStyleBorder()->mBoxShadow;
if (!shadows ||
(IsThemed() && GetContent() &&
!nsContentUtils::IsChromeDoc(GetContent()->GetCurrentDoc())))
return nsnull;
return shadows;
}
nscoord
nsFrame::GetBaseline() const
{
@ -970,7 +981,7 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
if (!IsVisibleForPainting(aBuilder))
return NS_OK;
PRBool hasBoxShadow = !!(GetStyleBorder()->mBoxShadow);
PRBool hasBoxShadow = GetEffectiveBoxShadows() != nsnull;
if (hasBoxShadow) {
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBoxShadowOuter(this));
@ -3880,8 +3891,8 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, PRBool* aAnyOutlineOrEffects,
*aAnyOutlineOrEffects = PR_FALSE;
// box-shadow
nsCSSShadowArray* boxShadows = aFrame->GetStyleBorder()->mBoxShadow;
if (boxShadows && !aFrame->IsThemed()) {
nsCSSShadowArray* boxShadows = aFrame->GetEffectiveBoxShadows();
if (boxShadows) {
nsRect shadows;
for (PRUint32 i = 0; i < boxShadows->Length(); ++i) {
nsRect tmpRect = r;

View File

@ -689,6 +689,10 @@ public:
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
nsStyleContext* aStyleContext) = 0;
// returns GetStyleBorder()->mBoxShadow unless this frame is using
// -moz-appearance and is not chrome
nsCSSShadowArray* GetEffectiveBoxShadows();
/**
* Accessor functions for geometric parent
*/