Bug 735898. Part 4: Create Inner/Outer box-shadow items only if we actually have inset/outset shadows. r=mattwoodrow

This commit is contained in:
Robert O'Callahan 2012-04-16 17:43:33 +12:00
parent c32be66d57
commit c205a2f3ae
2 changed files with 11 additions and 3 deletions

View File

@ -1436,8 +1436,8 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
if (!IsVisibleForPainting(aBuilder))
return NS_OK;
bool hasBoxShadow = GetStyleBorder()->mBoxShadow != nsnull;
if (hasBoxShadow) {
nsCSSShadowArray* shadows = GetStyleBorder()->mBoxShadow;
if (shadows && shadows->HasShadowWithInset(false)) {
nsresult rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBoxShadowOuter(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);
@ -1448,7 +1448,7 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
DisplayBackgroundUnconditional(aBuilder, aLists, aForceBackground, &bg);
NS_ENSURE_SUCCESS(rv, rv);
if (hasBoxShadow) {
if (shadows && shadows->HasShadowWithInset(true)) {
rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBoxShadowInner(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -724,6 +724,14 @@ class nsCSSShadowArray {
return &mArray[i];
}
bool HasShadowWithInset(bool aInset) {
for (PRUint32 i = 0; i < mLength; ++i) {
if (mArray[i].mInset == aInset)
return true;
}
return false;
}
NS_INLINE_DECL_REFCOUNTING(nsCSSShadowArray)
private: