diff --git a/layout/painting/DisplayItemClip.cpp b/layout/painting/DisplayItemClip.cpp index 098f22a0551a..4def94d26074 100644 --- a/layout/painting/DisplayItemClip.cpp +++ b/layout/painting/DisplayItemClip.cpp @@ -410,7 +410,7 @@ DisplayItemClip::AppendRoundedRects(nsTArray* aArray, uint32_t aCou } bool -DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip, +DisplayItemClip::ComputeRegionInClips(const DisplayItemClip* aOldClip, const nsPoint& aShift, nsRegion* aCombined) const { diff --git a/layout/painting/DisplayItemClip.h b/layout/painting/DisplayItemClip.h index c3ed1a67aecc..1ef0601f193a 100644 --- a/layout/painting/DisplayItemClip.h +++ b/layout/painting/DisplayItemClip.h @@ -121,7 +121,7 @@ public: * The result is stored in aCombined. If the result would be infinite * (because one or both of the clips does no clipping), returns false. */ - bool ComputeRegionInClips(DisplayItemClip* aOldClip, + bool ComputeRegionInClips(const DisplayItemClip* aOldClip, const nsPoint& aShift, nsRegion* aCombined) const; diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index 1cfc3638240c..24dfff98ad47 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -4852,27 +4852,22 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData, nsIntRect intClip; bool hasClip = false; if (aLayerState != LAYER_NONE) { - DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager()); - if (data) { - tempManager = data->mInactiveManager; + if (aData) { + tempManager = aData->mInactiveManager; + + // We need to grab these before calling AddLayerDisplayItem because it will overwrite them. + nsRegion clip; + if (aClip.ComputeRegionInClips(&aData->GetClip(), + aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin, + &clip)) { + intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale, + paintedData->mYScale, + paintedData->mAppUnitsPerDevPixel); + } } if (!tempManager) { tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE); } - - // We need to grab these before calling AddLayerDisplayItem because it will overwrite them. - nsRegion clip; - DisplayItemClip* oldClip = nullptr; - GetOldLayerFor(aItem, nullptr, &oldClip); - hasClip = aClip.ComputeRegionInClips(oldClip, - aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin, - &clip); - - if (hasClip) { - intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale, - paintedData->mYScale, - paintedData->mAppUnitsPerDevPixel); - } } AddLayerDisplayItem(layer, aItem, aLayerState, tempManager, aData); diff --git a/layout/painting/FrameLayerBuilder.h b/layout/painting/FrameLayerBuilder.h index 75f411aeed81..990c4045c9bd 100644 --- a/layout/painting/FrameLayerBuilder.h +++ b/layout/painting/FrameLayerBuilder.h @@ -69,6 +69,7 @@ public: uint32_t GetDisplayItemKey() { return mDisplayItemKey; } layers::Layer* GetLayer() const { return mLayer; } nsDisplayItemGeometry* GetGeometry() const { return mGeometry.get(); } + const DisplayItemClip& GetClip() const { return mClip; } void Invalidate() { mIsInvalid = true; } void ClearAnimationCompositorState();