Bug 803826 - Restore the layer builder pointer on return from PaintForFrame. r=mattwoodrow

It's possible for nsDisplayList::PaintForFrame to reset the layer builder
pointer on a layer manager it didn't create. Instead of setting it to null,
store the existing pointer and restore it on return.
This commit is contained in:
Chris Lord 2012-10-23 12:01:23 +01:00
parent df166e73aa
commit 7f25a0bb58

View File

@ -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<ContainerLayer> 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 {