diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 1e33cde98333..2ca93d961d2c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1014,6 +1014,9 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, layerManager = new BasicLayerManager(); } + // Store the existing layer builder to reinstate it on return. + FrameLayerBuilder *oldBuilder = layerManager->GetLayerBuilder(); + FrameLayerBuilder *layerBuilder = new FrameLayerBuilder(); layerBuilder->Init(aBuilder, layerManager); @@ -1050,13 +1053,13 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, nsRefPtr root = layerBuilder-> BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nullptr, *this, containerParameters, nullptr); - + if (widgetTransaction) { aForFrame->ClearInvalidationStateBits(); } if (!root) { - layerManager->RemoveUserData(&gLayerManagerLayerBuilder); + layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder); return; } // Root is being scaled up by the X/Y resolution. Scale it back down. @@ -1135,7 +1138,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder, } nsCSSRendering::DidPaint(); - layerManager->RemoveUserData(&gLayerManagerLayerBuilder); + layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder); } uint32_t nsDisplayList::Count() const {