diff --git a/gfx/layers/wr/ScrollingLayersHelper.cpp b/gfx/layers/wr/ScrollingLayersHelper.cpp index cba611b5440b..243ec1c8c319 100644 --- a/gfx/layers/wr/ScrollingLayersHelper.cpp +++ b/gfx/layers/wr/ScrollingLayersHelper.cpp @@ -21,7 +21,6 @@ ScrollingLayersHelper::ScrollingLayersHelper(WebRenderLayer* aLayer, : mLayer(aLayer) , mBuilder(&aBuilder) , mPushedLayerLocalClip(false) - , mClipsPushed(0) { if (!mLayer->WrManager()->AsyncPanZoomEnabled()) { // If APZ is disabled then we don't need to push the scrolling clips. We @@ -93,7 +92,6 @@ ScrollingLayersHelper::ScrollingLayersHelper(nsDisplayItem* aItem, : mLayer(nullptr) , mBuilder(&aBuilder) , mPushedLayerLocalClip(false) - , mClipsPushed(0) { DefineAndPushChain(aItem->GetClipChain(), aBuilder, aStackingContext, aItem->Frame()->PresContext()->AppUnitsPerDevPixel(), aCache); @@ -138,7 +136,7 @@ ScrollingLayersHelper::DefineAndPushChain(const DisplayItemClipChain* aChain, // Finally, push the clip onto the WR stack MOZ_ASSERT(clipId); aBuilder.PushClip(clipId.value()); - mClipsPushed++; + mPushedClips.push_back(wr::ScrollOrClipId(clipId.value())); } bool @@ -213,10 +211,12 @@ ScrollingLayersHelper::PushLayerClip(const LayerClip& aClip, ScrollingLayersHelper::~ScrollingLayersHelper() { if (!mLayer) { - // For layers-free mode - while (mClipsPushed > 0) { + // For layers-free mode. + while (!mPushedClips.empty()) { + wr::ScrollOrClipId id = mPushedClips.back(); + MOZ_ASSERT(id.is()); mBuilder->PopClip(); - mClipsPushed--; + mPushedClips.pop_back(); } return; } diff --git a/gfx/layers/wr/ScrollingLayersHelper.h b/gfx/layers/wr/ScrollingLayersHelper.h index 23c4e95dc603..dff5e11cd336 100644 --- a/gfx/layers/wr/ScrollingLayersHelper.h +++ b/gfx/layers/wr/ScrollingLayersHelper.h @@ -51,7 +51,7 @@ private: WebRenderLayer* mLayer; wr::DisplayListBuilder* mBuilder; bool mPushedLayerLocalClip; - int mClipsPushed; + std::vector mPushedClips; }; } // namespace layers diff --git a/gfx/webrender_bindings/WebRenderTypes.h b/gfx/webrender_bindings/WebRenderTypes.h index 2a50ab822428..1b051758ec9e 100644 --- a/gfx/webrender_bindings/WebRenderTypes.h +++ b/gfx/webrender_bindings/WebRenderTypes.h @@ -6,6 +6,7 @@ #ifndef GFX_WEBRENDERTYPES_H #define GFX_WEBRENDERTYPES_H +#include "FrameMetrics.h" #include "mozilla/webrender/webrender_ffi.h" #include "mozilla/Maybe.h" #include "mozilla/gfx/Matrix.h" @@ -14,6 +15,7 @@ #include "mozilla/layers/LayersTypes.h" #include "mozilla/PodOperations.h" #include "mozilla/Range.h" +#include "mozilla/Variant.h" #include "Units.h" #include "RoundedRect.h" #include "nsStyleConsts.h" @@ -662,6 +664,8 @@ struct WrClipId { } }; +typedef Variant ScrollOrClipId; + } // namespace wr } // namespace mozilla