diff --git a/layout/painting/FrameLayerBuilder.cpp b/layout/painting/FrameLayerBuilder.cpp index e2abb9a4cdf0..bc549f191a18 100644 --- a/layout/painting/FrameLayerBuilder.cpp +++ b/layout/painting/FrameLayerBuilder.cpp @@ -475,10 +475,10 @@ public: */ void Accumulate(ContainerState* aState, nsDisplayItem* aItem, - const nsIntRegion& aClippedOpaqueRegion, const nsIntRect& aVisibleRect, const DisplayItemClip& aClip, - LayerState aLayerState); + LayerState aLayerState, + nsDisplayList *aList); AnimatedGeometryRoot* GetAnimatedGeometryRoot() { return mAnimatedGeometryRoot; } /** @@ -3431,10 +3431,10 @@ IsItemAreaInWindowOpaqueRegion(nsDisplayListBuilder* aBuilder, void PaintedLayerData::Accumulate(ContainerState* aState, nsDisplayItem* aItem, - const nsIntRegion& aClippedOpaqueRegion, const nsIntRect& aVisibleRect, const DisplayItemClip& aClip, - LayerState aLayerState) + LayerState aLayerState, + nsDisplayList* aList) { FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against pld=%p\n", aItem->Name(), aItem, aItem->Frame(), this); @@ -3470,11 +3470,16 @@ PaintedLayerData::Accumulate(ContainerState* aState, return; } + nsIntRegion opaquePixels = aState->ComputeOpaqueRect(aItem, + mAnimatedGeometryRoot, mASR, aClip, aList, + &mHideAllLayersBelow, &mOpaqueForAnimatedGeometryRootParent); + opaquePixels.AndWith(aVisibleRect); + /* Mark as available for conversion to image layer if this is a nsDisplayImage and * it's the only thing visible in this layer. */ if (nsIntRegion(aVisibleRect).Contains(mVisibleRegion) && - aClippedOpaqueRegion.Contains(mVisibleRegion) && + opaquePixels.Contains(mVisibleRegion) && aItem->SupportsOptimizingToImage()) { mImage = static_cast(aItem); FLB_LOG_PAINTED_LAYER_DECISION(this, " Tracking image: nsDisplayImageContainer covers the layer\n"); @@ -3525,8 +3530,8 @@ PaintedLayerData::Accumulate(ContainerState* aState, mVisibleRegion.SimplifyOutward(4); } - if (!aClippedOpaqueRegion.IsEmpty()) { - for (auto iter = aClippedOpaqueRegion.RectIter(); !iter.Done(); iter.Next()) { + if (!opaquePixels.IsEmpty()) { + for (auto iter = opaquePixels.RectIter(); !iter.Done(); iter.Next()) { // We don't use SimplifyInward here since it's not defined exactly // what it will discard. For our purposes the most important case // is a large opaque background at the bottom of z-order (e.g., @@ -4486,14 +4491,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList, if (mManager->IsWidgetLayerManager()) { paintedLayerData->UpdateCommonClipCount(itemClip); } - nsIntRegion opaquePixels = ComputeOpaqueRect(item, - animatedGeometryRoot, itemASR, itemClip, aList, - &paintedLayerData->mHideAllLayersBelow, - &paintedLayerData->mOpaqueForAnimatedGeometryRootParent); - MOZ_ASSERT(nsIntRegion(itemDrawRect).Contains(opaquePixels)); - opaquePixels.AndWith(itemVisibleRect); - paintedLayerData->Accumulate(this, item, opaquePixels, - itemVisibleRect, itemClip, layerState); + paintedLayerData->Accumulate(this, item, itemVisibleRect, itemClip, layerState, aList); if (!paintedLayerData->mLayer) { // Try to recycle the old layer of this display item.