Bug 1130892 - Allow vibrancy in popups from non-chrome prescontexts. r=roc

This commit is contained in:
Markus Stange 2015-02-09 13:24:51 -05:00
Родитель 8919ee56bb
Коммит ae23b9318a
2 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

@ -582,7 +582,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mAllowMergingAndFlattening(true), mAllowMergingAndFlattening(true),
mWillComputePluginGeometry(false), mWillComputePluginGeometry(false),
mInTransform(false), mInTransform(false),
mIsInRootChromeDocument(false), mIsInChromePresContext(false),
mSyncDecodeImages(false), mSyncDecodeImages(false),
mIsPaintingToWindow(false), mIsPaintingToWindow(false),
mIsCompositingCheap(false), mIsCompositingCheap(false),
@ -590,7 +590,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mAncestorHasTouchEventHandler(false), mAncestorHasTouchEventHandler(false),
mAncestorHasScrollEventHandler(false), mAncestorHasScrollEventHandler(false),
mHaveScrollableDisplayPort(false), mHaveScrollableDisplayPort(false),
mWindowDraggingAllowed(false) mWindowDraggingAllowed(false),
mIsBuildingForPopup(nsLayoutUtils::IsPopup(aReferenceFrame))
{ {
MOZ_COUNT_CTOR(nsDisplayListBuilder); MOZ_COUNT_CTOR(nsDisplayListBuilder);
PL_InitArenaPool(&mPool, "displayListArena", 1024, PL_InitArenaPool(&mPool, "displayListArena", 1024,
@ -1015,8 +1016,7 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
nsPresContext* pc = aReferenceFrame->PresContext(); nsPresContext* pc = aReferenceFrame->PresContext();
pc->GetDocShell()->GetWindowDraggingAllowed(&mWindowDraggingAllowed); pc->GetDocShell()->GetWindowDraggingAllowed(&mWindowDraggingAllowed);
mIsInChromePresContext = pc->IsChrome();
mIsInRootChromeDocument = !IsInSubdocument() && pc->IsChrome();
} }
void void
@ -1032,7 +1032,7 @@ nsDisplayListBuilder::LeavePresShell(nsIFrame* aReferenceFrame)
if (!mPresShellStates.IsEmpty()) { if (!mPresShellStates.IsEmpty()) {
nsPresContext* pc = CurrentPresContext(); nsPresContext* pc = CurrentPresContext();
pc->GetDocShell()->GetWindowDraggingAllowed(&mWindowDraggingAllowed); pc->GetDocShell()->GetWindowDraggingAllowed(&mWindowDraggingAllowed);
mIsInRootChromeDocument = !IsInSubdocument() && pc->IsChrome(); mIsInChromePresContext = pc->IsChrome();
} }
} }
@ -2117,7 +2117,7 @@ static void
RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsITheme::ThemeGeometryType aType) nsITheme::ThemeGeometryType aType)
{ {
if (aBuilder->IsInRootChromeDocument() && !aBuilder->IsInTransform()) { if (aBuilder->IsInRootChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(aFrame); nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(aFrame);
nsRect borderBox(aFrame->GetOffsetTo(displayRoot), aFrame->GetSize()); nsRect borderBox(aFrame->GetOffsetTo(displayRoot), aFrame->GetSize());
aBuilder->RegisterThemeGeometry(aType, aBuilder->RegisterThemeGeometry(aType,
@ -2257,7 +2257,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
if (isThemed) { if (isThemed) {
nsITheme* theme = presContext->GetTheme(); nsITheme* theme = presContext->GetTheme();
if (theme->NeedToClearBackgroundBehindWidget(aFrame->StyleDisplay()->mAppearance) && if (theme->NeedToClearBackgroundBehindWidget(aFrame->StyleDisplay()->mAppearance) &&
aBuilder->IsInRootChromeDocument() && !aBuilder->IsInTransform()) { aBuilder->IsInRootChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
bgItemList.AppendNewToTop( bgItemList.AppendNewToTop(
new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame)); new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame));
} }

Просмотреть файл

@ -432,9 +432,13 @@ public:
/** /**
* Return true if we're currently building a display list for the root * Return true if we're currently building a display list for the root
* presshell which is the presshell of a chrome document. * presshell which is the presshell of a chrome document, or if we're
* building the display list for a popup and have not entered a subdocument
* inside that popup.
*/ */
bool IsInRootChromeDocument() { return mIsInRootChromeDocument; } bool IsInRootChromeDocumentOrPopup() {
return (mIsInChromePresContext || mIsBuildingForPopup) && !IsInSubdocument();
}
/** /**
* @return true if images have been set to decode synchronously. * @return true if images have been set to decode synchronously.
@ -911,7 +915,7 @@ private:
// True when we're building a display list that's directly or indirectly // True when we're building a display list that's directly or indirectly
// under an nsDisplayTransform // under an nsDisplayTransform
bool mInTransform; bool mInTransform;
bool mIsInRootChromeDocument; bool mIsInChromePresContext;
bool mSyncDecodeImages; bool mSyncDecodeImages;
bool mIsPaintingToWindow; bool mIsPaintingToWindow;
bool mIsCompositingCheap; bool mIsCompositingCheap;
@ -923,6 +927,7 @@ private:
// which WantsAsyncScroll(). // which WantsAsyncScroll().
bool mHaveScrollableDisplayPort; bool mHaveScrollableDisplayPort;
bool mWindowDraggingAllowed; bool mWindowDraggingAllowed;
bool mIsBuildingForPopup;
}; };
class nsDisplayItem; class nsDisplayItem;