Bug 852489. Part 1: Don't create nsDisplayButtonForegrounds for buttons that aren't focused. r=mats

This commit is contained in:
Robert O'Callahan
2013-03-22 15:17:27 +13:00
parent 4f41285038
commit 82765d863a

View File

@@ -185,11 +185,18 @@ nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
nsDisplayButtonBoxShadowOuter(aBuilder, this));
}
// Almost all buttons draw some kind of background so there's not much
// point in checking whether we should create this item.
aBackground->AppendNewToTop(new (aBuilder)
nsDisplayButtonBorderBackground(aBuilder, this));
aForeground->AppendNewToTop(new (aBuilder)
nsDisplayButtonForeground(aBuilder, this));
// Only display focus rings if we actually have them. Since at most one
// button would normally display a focus ring, most buttons won't have them.
if ((mOuterFocusStyle && mOuterFocusStyle->StyleBorder()->HasBorder()) ||
(mInnerFocusStyle && mInnerFocusStyle->StyleBorder()->HasBorder())) {
aForeground->AppendNewToTop(new (aBuilder)
nsDisplayButtonForeground(aBuilder, this));
}
return NS_OK;
}