diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index 555d3907abde..9e1b172cdedf 100644 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -530,6 +530,10 @@ ContainerRender(ContainerT* aContainer, LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(aContainer->GetMaskLayer(), effectChain, !aContainer->GetTransform().CanDraw2D()); + if (autoMaskEffect.Failed()) { + NS_WARNING("Failed to apply a mask effect."); + return; + } aContainer->AddBlendModeEffect(effectChain); effectChain.mPrimaryEffect = new EffectRenderTarget(surface); diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 62152fde854b..7af331d14ca6 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -828,7 +828,7 @@ LayerManagerComposite::CreateRefLayerComposite() LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer, EffectChain& aEffects, bool aIs3D) - : mCompositable(nullptr) + : mCompositable(nullptr), mFailed(false) { if (!aMaskLayer) { return; @@ -837,11 +837,13 @@ LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer, mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost(); if (!mCompositable) { NS_WARNING("Mask layer with no compositable host"); + mFailed = true; return; } if (!mCompositable->AddMaskEffect(aEffects, aMaskLayer->GetEffectiveTransform(), aIs3D)) { mCompositable = nullptr; + mFailed = true; } } diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index d5183186e55c..555b551bdd1e 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -184,8 +184,10 @@ public: bool aIs3D = false); ~AutoAddMaskEffect(); + bool Failed() const { return mFailed; } private: CompositableHost* mCompositable; + bool mFailed; }; /**