Bug 815591. Don't build nsDisplayBackgroundColor if there is no background color and we're not going to do hit-testing. r=mattwoodrow

--HG--
extra : rebase_source : ce6fbf882f00d7c3ceb7f149bb6e9cb21ed6f74d
This commit is contained in:
Robert O'Callahan 2012-11-28 01:50:09 +13:00
parent 8868e9761e
commit f12ff30dc6

View File

@ -1565,11 +1565,13 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
drawBackgroundImage, drawBackgroundColor);
}
// Even if we don't actually have a background color to paint, we still need
// to create the item because it's used for hit testing.
aList->AppendNewToTop(
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
// Even if we don't actually have a background color to paint, we may still need
// to create an item for hit testing.
if (color != NS_RGBA(0,0,0,0) || aBuilder->IsForEventDelivery()) {
aList->AppendNewToTop(
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
}
// Passing bg == nullptr in this macro will result in one iteration with
// i = 0.