Bug 866470 - Make the style context lookup in nsDisplayList match what nsCSSRendering does. r=roc

This commit is contained in:
Matt Woodrow 2013-05-08 15:47:31 +12:00
parent 452720f8d7
commit f46eb6a53e

View File

@ -1606,6 +1606,29 @@ nsDisplayBackgroundImage::WriteDebugInfo(FILE *aOutput)
} }
#endif #endif
static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame)
{
nsStyleContext *sc;
if (!nsCSSRendering::FindBackground(aFrame, &sc)) {
// We don't want to bail out if moz-appearance is set on a root
// node. If it has a parent content node, bail because it's not
// a root, other wise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
if (!aFrame->StyleDisplay()->mAppearance) {
return nullptr;
}
nsIContent* content = aFrame->GetContent();
if (!content || content->GetParent()) {
return nullptr;
}
sc = aFrame->StyleContext();
}
return sc;
}
/*static*/ nsresult /*static*/ nsresult
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder, nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsIFrame* aFrame,
@ -1616,9 +1639,12 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
const nsStyleBackground* bg = nullptr; const nsStyleBackground* bg = nullptr;
nsPresContext* presContext = aFrame->PresContext(); nsPresContext* presContext = aFrame->PresContext();
bool isThemed = aFrame->IsThemed(); bool isThemed = aFrame->IsThemed();
if (!isThemed && nsCSSRendering::FindBackground(aFrame, &bgSC)) { if (!isThemed) {
bgSC = GetBackgroundStyleContext(aFrame);
if (bgSC) {
bg = bgSC->StyleBackground(); bg = bgSC->StyleBackground();
} }
}
bool drawBackgroundColor = false; bool drawBackgroundColor = false;
nscolor color; nscolor color;