diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 7ca2909ad688..a6c148bb0931 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -904,7 +904,7 @@ nsIFrame::AddDisplayItem(nsDisplayItem* aItem) items = new DisplayItemArray(); AddProperty(DisplayItems(), items); } - MOZ_DIAGNOSTIC_ASSERT(!items->Contains(aItem)); + MOZ_ASSERT(!items->Contains(aItem)); items->AppendElement(aItem); } diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index 7413adc83b0b..1bf7b6e4eaa0 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -720,8 +720,6 @@ void nsSimplePageSequenceFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { - aBuilder->SetInPageSequence(true); - aBuilder->SetDisablePartialUpdates(true); DisplayBorderBackgroundOutline(aBuilder, aLists); nsDisplayList content; @@ -755,7 +753,6 @@ nsSimplePageSequenceFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, ::ComputePageSequenceTransform)); aLists.Content()->AppendToTop(&content); - aBuilder->SetInPageSequence(false); } //------------------------------------------------------------------------------ diff --git a/layout/painting/RetainedDisplayListBuilder.cpp b/layout/painting/RetainedDisplayListBuilder.cpp index 4695785b3564..94fb197c06ab 100644 --- a/layout/painting/RetainedDisplayListBuilder.cpp +++ b/layout/painting/RetainedDisplayListBuilder.cpp @@ -117,11 +117,6 @@ RetainedDisplayListBuilder::PreProcessDisplayList(RetainedDisplayList* aList, aList->mOldItems.SetCapacity(aList->Count()); MOZ_ASSERT(aList->mOldItems.IsEmpty()); while (nsDisplayItem* item = aList->RemoveBottom()) { -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED - item->mMergedItem = false; - item->mPreProcessedItem = true; -#endif - if (item->HasDeletedFrame() || !item->CanBeReused()) { size_t i = aList->mOldItems.Length(); aList->mOldItems.AppendElement(OldItemInfo(nullptr)); @@ -281,10 +276,8 @@ public: if (!HasModifiedFrame(aNewItem) && HasMatchingItemInOldList(aNewItem, &oldIndex)) { nsDisplayItem* oldItem = mOldItems[oldIndex.val].mItem; - MOZ_DIAGNOSTIC_ASSERT(oldItem->GetPerFrameKey() == aNewItem->GetPerFrameKey() && - oldItem->Frame() == aNewItem->Frame()); if (!mOldItems[oldIndex.val].IsChanged()) { - MOZ_DIAGNOSTIC_ASSERT(!mOldItems[oldIndex.val].IsUsed()); + MOZ_ASSERT(!mOldItems[oldIndex.val].IsUsed()); if (aNewItem->GetChildren()) { Maybe containerASRForChildren; if (mBuilder->MergeDisplayLists(aNewItem->GetChildren(), @@ -363,20 +356,6 @@ public: Span aDirectPredecessors, const Maybe& aExtraDirectPredecessor) { UpdateContainerASR(aItem); - -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED - nsIFrame::DisplayItemArray* items = aItem->Frame()->GetProperty(nsIFrame::DisplayItems()); - for (nsDisplayItem* i : *items) { - if (i->Frame() == aItem->Frame() && - i->GetPerFrameKey() == aItem->GetPerFrameKey()) { - MOZ_DIAGNOSTIC_ASSERT(!i->mMergedItem); - } - } - - aItem->mMergedItem = true; - aItem->mPreProcessedItem = false; -#endif - mMergedItems.AppendToTop(aItem); MergedListIndex newIndex = mMergedDAG.AddNode(aDirectPredecessors, aExtraDirectPredecessor); return newIndex; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 65a7499a1d96..2fa39d52a420 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -124,26 +124,6 @@ SpammyLayoutWarningsEnabled() } #endif -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED -void AssertUniqueItem(nsDisplayItem* aItem) { - nsIFrame::DisplayItemArray* items = aItem->Frame()->GetProperty(nsIFrame::DisplayItems()); - if (!items) { - return; - } - for (nsDisplayItem* i : *items) { - if (i != aItem && - !i->HasDeletedFrame() && - i->Frame() == aItem->Frame() && - i->GetPerFrameKey() == aItem->GetPerFrameKey()) { - if (i->mPreProcessedItem) { - continue; - } - MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!"); - } - } -} -#endif - /* static */ bool ActiveScrolledRoot::IsAncestor(const ActiveScrolledRoot* aAncestor, const ActiveScrolledRoot* aDescendant) @@ -1016,7 +996,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, mAllowMergingAndFlattening(true), mWillComputePluginGeometry(false), mInTransform(false), - mInPageSequence(false), mIsInChromePresContext(false), mSyncDecodeImages(false), mIsPaintingToWindow(false), @@ -3109,8 +3088,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) {} nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - const ActiveScrolledRoot* aActiveScrolledRoot, - bool aAnonymous) + const ActiveScrolledRoot* aActiveScrolledRoot) : mFrame(aFrame) , mActiveScrolledRoot(aActiveScrolledRoot) , mAnimatedGeometryRoot(nullptr) @@ -3124,7 +3102,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, #endif { MOZ_COUNT_CTOR(nsDisplayItem); - if (aBuilder->IsRetainingDisplayList() && !aAnonymous) { + if (aBuilder->IsRetainingDisplayList()) { mFrame->AddDisplayItem(this); } mReferenceFrame = aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame); @@ -6115,18 +6093,17 @@ nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder, } nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsDisplayList* aList, bool aAnonymous) + nsIFrame* aFrame, nsDisplayList* aList) : nsDisplayWrapList(aBuilder, aFrame, aList, - aBuilder->CurrentActiveScrolledRoot(), false, 0, aAnonymous) + aBuilder->CurrentActiveScrolledRoot()) {} nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, bool aClearClipChain, - uint32_t aIndex, - bool aAnonymous) - : nsDisplayItem(aBuilder, aFrame, aActiveScrolledRoot, aAnonymous) + uint32_t aIndex) + : nsDisplayItem(aBuilder, aFrame, aActiveScrolledRoot) , mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot()) , mOverrideZIndex(0) , mIndex(aIndex) @@ -6169,8 +6146,8 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, } nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsDisplayItem* aItem, bool aAnonymous) - : nsDisplayItem(aBuilder, aFrame, aBuilder->CurrentActiveScrolledRoot(), aAnonymous) + nsIFrame* aFrame, nsDisplayItem* aItem) + : nsDisplayItem(aBuilder, aFrame) , mOverrideZIndex(0) , mIndex(0) , mHasZIndexOverride(false) @@ -9162,7 +9139,7 @@ nsDisplayPerspective::nsDisplayPerspective(nsDisplayListBuilder* aBuilder, nsIFrame* aPerspectiveFrame, nsDisplayList* aList) : nsDisplayItem(aBuilder, aPerspectiveFrame) - , mList(aBuilder, aPerspectiveFrame, aList, true) + , mList(aBuilder, aPerspectiveFrame, aList) , mTransformFrame(aTransformFrame) , mIndex(aBuilder->AllocatePerspectiveItemIndex()) { diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index 2dc4ccae15c0..53221fb4033c 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -835,9 +835,6 @@ public: */ void SetInTransform(bool aInTransform) { mInTransform = aInTransform; } - bool IsInPageSequence() const { return mInPageSequence; } - void SetInPageSequence(bool aInPage) { mInPageSequence = aInPage; } - /** * Return true if we're currently building a display list for a * nested presshell. @@ -1982,7 +1979,6 @@ private: // True when we're building a display list that's directly or indirectly // under an nsDisplayTransform bool mInTransform; - bool mInPageSequence; bool mIsInChromePresContext; bool mSyncDecodeImages; bool mIsPaintingToWindow; @@ -2028,10 +2024,6 @@ protected: class nsDisplayWrapList; -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED -void AssertUniqueItem(nsDisplayItem* aItem); -#endif - template MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder, Args&&... aArgs) @@ -2050,14 +2042,6 @@ MakeDisplayItem(nsDisplayListBuilder* aBuilder, Args&&... aArgs) } } -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED - if (aBuilder->IsRetainingDisplayList() && - !aBuilder->IsInPageSequence() && - aBuilder->IsBuilding()) { - AssertUniqueItem(item); - } -#endif - return item; } @@ -2099,8 +2083,7 @@ public: // need to count constructors and destructors. nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame); nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - const ActiveScrolledRoot* aActiveScrolledRoot, - bool aAnonymous = false); + const ActiveScrolledRoot* aActiveScrolledRoot); /** * This constructor is only used in rare cases when we need to construct @@ -2855,18 +2838,12 @@ public: // used by RetainedDisplayListBuilder. void SetOldListIndex(nsDisplayList* aList, OldListIndex aIndex) { -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED mOldList = reinterpret_cast(aList); -#endif mOldListIndex = aIndex; } OldListIndex GetOldListIndex(nsDisplayList* aList) { -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED - if (mOldList != reinterpret_cast(aList)) { - MOZ_CRASH_UNSAFE_PRINTF("Item found was in the wrong list! type %d", GetPerFrameKey()); - } -#endif + MOZ_ASSERT(mOldList == reinterpret_cast(aList)); return mOldListIndex; } @@ -2905,13 +2882,7 @@ private: protected: -#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED -public: - uintptr_t mOldList = 0; - bool mMergedItem = false; - bool mPreProcessedItem = false; -protected: -#endif + mozilla::DebugOnly mOldList; OldListIndex mOldListIndex; bool mForceNotVisible; @@ -5038,15 +5009,14 @@ public: * Takes all the items from aList and puts them in our list. */ nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList* aList, bool aAnonymous = false); + nsDisplayList* aList); nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, bool aClearClipChain = false, - uint32_t aIndex = 0, - bool aAnonymous = false); + uint32_t aIndex = 0); nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayItem* aItem, bool aAnonymous = false); + nsDisplayItem* aItem); nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) : nsDisplayItem(aBuilder, aFrame) , mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot()) @@ -6322,10 +6292,10 @@ class nsDisplayTransform: public nsDisplayItem public: StoreList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) : - nsDisplayWrapList(aBuilder, aFrame, aList, true) {} + nsDisplayWrapList(aBuilder, aFrame, aList) {} StoreList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayItem* aItem) : - nsDisplayWrapList(aBuilder, aFrame, aItem, true) {} + nsDisplayWrapList(aBuilder, aFrame, aItem) {} virtual ~StoreList() {} virtual void UpdateBounds(nsDisplayListBuilder* aBuilder) override { @@ -6693,12 +6663,6 @@ public: mFrame->Combines3DTransformWithAncestors(); } - virtual void RemoveFrame(nsIFrame* aFrame) override - { - nsDisplayItem::RemoveFrame(aFrame); - mStoredList.RemoveFrame(aFrame); - } - private: void ComputeBounds(nsDisplayListBuilder* aBuilder); void SetReferenceFrameToAncestor(nsDisplayListBuilder* aBuilder); @@ -6873,7 +6837,6 @@ public: mTransformFrame = nullptr; } nsDisplayItem::RemoveFrame(aFrame); - mList.RemoveFrame(aFrame); } private: