From 479663fd7192477310a03d40c2219322f97fb047 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 11 Oct 2012 18:44:59 +1300 Subject: [PATCH] Bug 797295 - Add support for the layer attribute to nsImageBoxFrame. r=roc --- layout/generic/nsFrame.cpp | 10 ++++++++++ layout/generic/nsIFrame.h | 2 ++ layout/xul/base/src/nsImageBoxFrame.cpp | 10 +++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f58624412b0..55aa0a30dc8 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -8166,6 +8166,16 @@ nsFrame::InitBoxMetrics(bool aClear) metrics->mLastSize.SizeTo(0, 0); } +void +nsIFrame::CreateOwnLayerIfNeeded(nsDisplayListBuilder* aBuilder, + nsDisplayList* aList) +{ + if (GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer)) { + aList->AppendNewToTop(new (aBuilder) + nsDisplayOwnLayer(aBuilder, this, aList)); + } +} + // Box layout debugging #ifdef DEBUG_REFLOW int32_t gIndent2 = 0; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 69a2bc25a7b..ca7bc11bb0b 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -2907,6 +2907,8 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty())) bool IsSVGText() const { return mState & NS_FRAME_IS_SVG_TEXT; } + void CreateOwnLayerIfNeeded(nsDisplayListBuilder* aBuilder, nsDisplayList* aList); + protected: // Members nsRect mRect; diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index 0210fe016f2..a5033ea4007 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -304,8 +304,16 @@ nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (!IsVisibleForPainting(aBuilder)) return NS_OK; - return aLists.Content()->AppendNewToTop( + + nsDisplayList list; + rv = list.AppendNewToTop( new (aBuilder) nsDisplayXULImage(aBuilder, this)); + NS_ENSURE_SUCCESS(rv, rv); + + CreateOwnLayerIfNeeded(aBuilder, &list); + + aLists.Content()->AppendToTop(&list); + return NS_OK; } void