Bug 1398845 - Handle null mBuffer in PaintedLayerComposite::IsOpaque r?mstange
In some cases we can end up with a PaintedLayerComposite still present
in the layer tree but with its mBuffer cleaned up. Whether this should
be occurring or not is still under discussion, but nevertheless a
PaintedLayerComposite without its mBuffer should not be considered
opaque, and treating it as opaque results in a black flash on OSX when
following links from the activity stream.
MozReview-Commit-ID: KklHEivfBWZ
--- a/gfx/layers/composite/PaintedLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -145,16 +145,25 @@ void
PaintedLayerComposite::CleanupResources()
{
if (mBuffer) {
mBuffer->Detach(this);
}
mBuffer = nullptr;
}
+bool
+PaintedLayerComposite::IsOpaque()
+{
+ if (!mBuffer || !mBuffer->IsAttached()) {
+ return false;
+ }
+ return PaintedLayer::IsOpaque();
+}
+
void
PaintedLayerComposite::GenEffectChain(EffectChain& aEffect)
{
aEffect.mLayerRef = this;
aEffect.mPrimaryEffect = mBuffer->GenEffect(GetSamplingFilter());
}
void
--- a/gfx/layers/composite/PaintedLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -48,16 +48,18 @@ public:
virtual void SetLayerManager(HostLayerManager* aManager) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect,
const Maybe<gfx::Polygon>& aGeometry) override;
virtual void CleanupResources() override;
+ virtual bool IsOpaque() override;
+
virtual void GenEffectChain(EffectChain& aEffect) override;
virtual bool SetCompositableHost(CompositableHost* aHost) override;
virtual HostLayer* AsHostLayer() override { return this; }
virtual void InvalidateRegion(const nsIntRegion& aRegion) override
{