From 4dafc50d7903018188818b30461c3b09ebcd032d Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Tue, 15 Jul 2014 10:30:01 +0200 Subject: [PATCH] Backed out changeset 7e9751c1302a (bug 1022612) --- layout/base/nsDisplayList.cpp | 1 + layout/base/nsDisplayList.h | 31 +++++++++++++++++++++++++++ layout/generic/nsFrame.cpp | 7 ++++++ layout/generic/nsSubDocumentFrame.cpp | 7 ++++++ 4 files changed, 46 insertions(+) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index f5aa423e234..404fcd88184 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -513,6 +513,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, mAllowMergingAndFlattening(true), mWillComputePluginGeometry(false), mInTransform(false), + mInFixedPos(false), mSyncDecodeImages(false), mIsPaintingToWindow(false), mIsCompositingCheap(false), diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 043019cd74c..3132ee0e345 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -406,6 +406,12 @@ public: */ void SetInTransform(bool aInTransform) { mInTransform = aInTransform; } + /** + * Returns true if we're currently building display items that are in + * true fixed position subtree. + */ + bool IsInFixedPos() const { return mInFixedPos; } + /** * @return true if images have been set to decode synchronously. */ @@ -592,6 +598,25 @@ public: bool mOldValue; }; + /** + * A helper class to temporarily set the value of mInFixedPos. + */ + class AutoInFixedPosSetter; + friend class AutoInFixedPosSetter; + class AutoInFixedPosSetter { + public: + AutoInFixedPosSetter(nsDisplayListBuilder* aBuilder, bool aInFixedPos) + : mBuilder(aBuilder), mOldValue(aBuilder->mInFixedPos) { + aBuilder->mInFixedPos = aInFixedPos; + } + ~AutoInFixedPosSetter() { + mBuilder->mInFixedPos = mOldValue; + } + private: + nsDisplayListBuilder* mBuilder; + bool mOldValue; + }; + /** * A helper class to temporarily set the value of mCurrentScrollParentId. */ @@ -765,6 +790,7 @@ private: // True when we're building a display list that's directly or indirectly // under an nsDisplayTransform bool mInTransform; + bool mInFixedPos; bool mSyncDecodeImages; bool mIsPaintingToWindow; bool mIsCompositingCheap; @@ -822,6 +848,7 @@ public: nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) : mFrame(aFrame) , mClip(aBuilder->ClipState().GetCurrentCombinedClip(aBuilder)) + , mInFixedPos(aBuilder->IsInFixedPos()) #ifdef MOZ_DUMP_PAINTING , mPainted(false) #endif @@ -839,6 +866,7 @@ public: : mFrame(aFrame) , mClip(nullptr) , mReferenceFrame(nullptr) + , mInFixedPos(false) #ifdef MOZ_DUMP_PAINTING , mPainted(false) #endif @@ -1332,6 +1360,8 @@ public: } } + bool IsInFixedPos() { return mInFixedPos; } + protected: friend class nsDisplayList; @@ -1349,6 +1379,7 @@ protected: // of the item. Paint implementations can use this to limit their drawing. // Guaranteed to be contained in GetBounds(). nsRect mVisibleRect; + bool mInFixedPos; #ifdef MOZ_DUMP_PAINTING // True if this frame has been painted. bool mPainted; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index c34acc30aed..0f80ba3bd7b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2290,6 +2290,13 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, NS_ASSERTION(!isStackingContext || pseudoStackingContext, "Stacking contexts must also be pseudo-stacking-contexts"); + bool isInFixedPos = aBuilder->IsInFixedPos() || + (isPositioned && + disp->mPosition == NS_STYLE_POSITION_FIXED && + nsLayoutUtils::IsReallyFixedPos(child)); + nsDisplayListBuilder::AutoInFixedPosSetter + buildingInFixedPos(aBuilder, isInFixedPos); + nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(aBuilder, child, dirty, pseudoStackingContext); DisplayListClipState::AutoClipMultiple clipState(aBuilder); diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 30c4893bb0d..fa40ed672d8 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -444,6 +444,13 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, haveDisplayPort || presContext->IsRootContentDocument() || (sf && sf->IsScrollingActive()); + // Don't let in fixed pos propagate down to child documents. This makes + // it a little less effective but doesn't regress an important case of a + // child document being in a fixed pos element where we would do no occlusion + // at all if we let it propagate down. + nsDisplayListBuilder::AutoInFixedPosSetter + buildingInFixedPos(aBuilder, false); + nsDisplayList childItems; {