diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index 48ec5db56251..ae40b46e5e5d 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -3606,7 +3606,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem, data.mClipChain = aClipChain; data.mAnimatedGeometryRootOffset = aTopLeft; data.mReferenceFrame = aItem->ReferenceFrame(); - data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden(); + data.mBackfaceHidden = aItem->In3DContextAndBackfaceIsHidden(); data.mNewChildLayersIndex = mNewChildLayers.Length(); NewLayerEntry* newLayerEntry = mNewChildLayers.AppendElement(); @@ -4442,7 +4442,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) PaintedLayerData* paintedLayerData = mPaintedLayerDataTree.FindPaintedLayerFor(animatedGeometryRoot, itemASR, layerClipChain, itemVisibleRect, - item->Frame()->In3DContextAndBackfaceIsHidden(), + item->In3DContextAndBackfaceIsHidden(), [&]() { return NewPaintedLayerData(item, animatedGeometryRoot, itemASR, layerClipChain, scrollMetadataASR, topLeft); diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index f26f5be93f65..258fa376593a 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -2949,6 +2949,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, , mForceNotVisible(aBuilder->IsBuildingInvisibleItems()) , mDisableSubpixelAA(false) , mReusedItem(false) + , mBackfaceHidden(mFrame->In3DContextAndBackfaceIsHidden()) #ifdef MOZ_DUMP_PAINTING , mPainted(false) #endif diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index c267b26501e8..708cd2ecf28b 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -2003,6 +2003,7 @@ public: , mForceNotVisible(false) , mDisableSubpixelAA(false) , mReusedItem(false) + , mBackfaceHidden(mFrame->In3DContextAndBackfaceIsHidden()) #ifdef MOZ_DUMP_PAINTING , mPainted(false) #endif @@ -2074,6 +2075,7 @@ public: , mForceNotVisible(aOther.mForceNotVisible) , mDisableSubpixelAA(aOther.mDisableSubpixelAA) , mReusedItem(false) + , mBackfaceHidden(mFrame->In3DContextAndBackfaceIsHidden()) #ifdef MOZ_DUMP_PAINTING , mPainted(false) #endif @@ -2704,16 +2706,7 @@ public: bool In3DContextAndBackfaceIsHidden() { - if (mBackfaceHidden) { - return *mBackfaceHidden; - } - - // We never need to invalidate this cached value since we're - // guaranteed to rebuild the display item entirely if it changes. - bool backfaceHidden = Frame()->In3DContextAndBackfaceIsHidden(); - mBackfaceHidden.emplace(backfaceHidden); - - return backfaceHidden; + return mBackfaceHidden; } bool HasSameTypeAndClip(const nsDisplayItem* aOther) const @@ -2774,11 +2767,11 @@ protected: bool mForceNotVisible; bool mDisableSubpixelAA; bool mReusedItem; + bool mBackfaceHidden; #ifdef MOZ_DUMP_PAINTING // True if this frame has been painted. bool mPainted; #endif - mozilla::Maybe mBackfaceHidden; struct { nsRect mVisibleRect;