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
Родитель def7614df5
Коммит 0d4c256f4e
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1014,6 +1014,9 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
layerManager = new BasicLayerManager(); layerManager = new BasicLayerManager();
} }
// Store the existing layer builder to reinstate it on return.
FrameLayerBuilder *oldBuilder = layerManager->GetLayerBuilder();
FrameLayerBuilder *layerBuilder = new FrameLayerBuilder(); FrameLayerBuilder *layerBuilder = new FrameLayerBuilder();
layerBuilder->Init(aBuilder, layerManager); layerBuilder->Init(aBuilder, layerManager);
@ -1056,7 +1059,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
} }
if (!root) { if (!root) {
layerManager->RemoveUserData(&gLayerManagerLayerBuilder); layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
return; return;
} }
// Root is being scaled up by the X/Y resolution. Scale it back down. // 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(); nsCSSRendering::DidPaint();
layerManager->RemoveUserData(&gLayerManagerLayerBuilder); layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
} }
uint32_t nsDisplayList::Count() const { uint32_t nsDisplayList::Count() const {