Bug 1285619 - Introduce a ResetLayerStateForRecycling() helper function. r=mstange

MozReview-Commit-ID: DLktq4PYNba

--HG--
extra : rebase_source : ff9445f1d2593232b30d1ef643af5dd30c7e6375
This commit is contained in:
Botond Ballo 2016-07-08 16:30:47 -04:00
parent db58db163a
commit 271ec9548b

View File

@ -2050,6 +2050,15 @@ FrameLayerBuilder::GetDebugSingleOldPaintedLayerForFrame(nsIFrame* aFrame)
return layer->AsPaintedLayer();
}
// Reset state that should not persist when a layer is recycled.
static void
ResetLayerStateForRecycling(Layer* aLayer) {
// Currently, this clears the mask layer and ancestor mask layers.
// Other cleanup may be added here.
aLayer->SetMaskLayer(nullptr);
aLayer->SetAncestorMaskLayers({});
}
already_AddRefed<ColorLayer>
ContainerState::CreateOrRecycleColorLayer(PaintedLayer *aPainted)
{
@ -2268,8 +2277,7 @@ ContainerState::RecyclePaintedLayer(PaintedLayer* aLayer,
{
// Clear clip rect and mask layer so we don't accidentally stay clipped.
// We will reapply any necessary clipping.
aLayer->SetMaskLayer(nullptr);
aLayer->SetAncestorMaskLayers({});
ResetLayerStateForRecycling(aLayer);
aLayer->ClearExtraDumpInfo();
PaintedDisplayItemLayerUserData* data =
@ -5230,8 +5238,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
NS_ASSERTION(oldLayer->GetType() == Layer::TYPE_CONTAINER,
"Wrong layer type");
containerLayer = static_cast<ContainerLayer*>(oldLayer);
containerLayer->SetMaskLayer(nullptr);
containerLayer->SetAncestorMaskLayers({});
ResetLayerStateForRecycling(containerLayer);
}
}
}