diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 90a89c9648fb..75eb3859d56c 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -134,7 +134,6 @@ impl WrSpaceAndClipChain { #[repr(C)] pub enum WrStackingContextClip { None, - ClipId(WrClipId), ClipChain(u64), } @@ -143,7 +142,6 @@ impl WrStackingContextClip { match *self { WrStackingContextClip::None => None, WrStackingContextClip::ClipChain(id) => Some(clip_chain_id_to_webrender(id, pipeline_id)), - WrStackingContextClip::ClipId(id) => Some(id.to_webrender(pipeline_id)), } } } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 36e87e81e819..8a94d8ce5d6c 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -8015,7 +8015,7 @@ void nsDisplayMasksAndClipPaths::Paint(nsDisplayListBuilder* aBuilder, }); } -static Maybe CreateSimpleClipRegion( +static Maybe CreateSimpleClipRegion( const nsDisplayMasksAndClipPaths& aDisplayItem, wr::DisplayListBuilder& aBuilder) { nsIFrame* frame = aDisplayItem.Frame(); @@ -8091,7 +8091,9 @@ static Maybe CreateSimpleClipRegion( return Nothing(); } - return Some(clipId); + wr::WrClipChainId clipChainId = aBuilder.DefineClipChain({clipId}, true); + + return Some(clipChainId); } static void FillPolygonDataForDisplayItem( @@ -8131,7 +8133,7 @@ static void FillPolygonDataForDisplayItem( : wr::FillRule::Evenodd; } -static Maybe CreateWRClipPathAndMasks( +static Maybe CreateWRClipPathAndMasks( nsDisplayMasksAndClipPaths* aDisplayItem, const LayoutDeviceRect& aBounds, wr::IpcResourceUpdateQueue& aResources, wr::DisplayListBuilder& aBuilder, const StackingContextHelper& aSc, RenderRootStateManager* aManager, @@ -8155,7 +8157,9 @@ static Maybe CreateWRClipPathAndMasks( wr::WrClipId clipId = aBuilder.DefineImageMaskClip(mask.ref(), points, fillRule); - return Some(clipId); + wr::WrClipChainId clipChainId = aBuilder.DefineClipChain({clipId}, true); + + return Some(clipChainId); } bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands( @@ -8168,7 +8172,7 @@ bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands( LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBounds, appUnitsPerDevPixel); - Maybe clip = CreateWRClipPathAndMasks( + Maybe clip = CreateWRClipPathAndMasks( this, bounds, aResources, aBuilder, aSc, aManager, aDisplayListBuilder); float oldOpacity = aBuilder.GetInheritedOpacity(); @@ -8189,7 +8193,7 @@ bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands( : Nothing(); wr::StackingContextParams params; - params.clip = wr::WrStackingContextClip::ClipId(*clip); + params.clip = wr::WrStackingContextClip::ClipChain(clip->id); params.opacity = opacity.ptrOr(nullptr); if (mWrapsBackdropFilter) { params.flags |= wr::StackingContextFlags::WRAPS_BACKDROP_FILTER; @@ -8428,16 +8432,18 @@ bool nsDisplayFilters::CreateWebRenderCommands( return true; } - wr::WrStackingContextClip clip{}; + uint64_t clipChainId; if (filterClip) { auto devPxRect = LayoutDeviceRect::FromAppUnits( filterClip.value() + ToReferenceFrame(), auPerDevPixel); - wr::WrClipId clipId = + auto clipId = aBuilder.DefineRectClip(Nothing(), wr::ToLayoutRect(devPxRect)); - clip = wr::WrStackingContextClip::ClipId(clipId); + clipChainId = aBuilder.DefineClipChain({clipId}, true).id; } else { - clip = wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId()); + clipChainId = aBuilder.CurrentClipChainId(); } + wr::WrStackingContextClip clip = + wr::WrStackingContextClip::ClipChain(clipChainId); float opacity = aBuilder.GetInheritedOpacity(); aBuilder.SetInheritedOpacity(1.0f);