Bug 1083635. Part 4: Return LayerManager from nsDisplayList::PaintRoot, and dump its contents in nsLayoutUtils::PaintFrame. r=mattwoodrow

--HG--
extra : rebase_source : 8c39aebedb275b56eda4a740b63ae4e00523c206
This commit is contained in:
Robert O'Callahan 2014-10-21 10:32:10 +13:00
parent 7d45b99ff8
commit c72141ba76
4 changed files with 21 additions and 25 deletions

View File

@ -1283,9 +1283,9 @@ nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder,
* single layer representing the display list, and then making it the
* root of the layer manager, drawing into the PaintedLayers.
*/
void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
uint32_t aFlags) {
already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
uint32_t aFlags) {
PROFILER_LABEL("nsDisplayList", "PaintRoot",
js::ProfileEntry::Category::GRAPHICS);
@ -1311,7 +1311,7 @@ void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
if (!layerManager) {
if (!aCtx) {
NS_WARNING("Nowhere to paint into");
return;
return nullptr;
}
layerManager = new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN);
}
@ -1369,7 +1369,7 @@ void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
if (!root) {
layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
return;
return nullptr;
}
// Root is being scaled up by the X/Y resolution. Scale it back down.
root->SetPostScale(1.0f/containerParameters.mXScale,
@ -1468,6 +1468,7 @@ void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
}
layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
return layerManager.forget();
}
uint32_t nsDisplayList::Count() const {

View File

@ -1657,10 +1657,11 @@ public:
* If PAINT_COMPRESSED is set, the FrameLayerBuilder should be set to compressed mode
* to avoid short cut optimizations.
*
* ComputeVisibility must be called before Paint.
*
* This must only be called on the root display list of the display list
* tree.
*
* We return the layer manager used for painting --- mainly so that
* callers can dump its layer tree if necessary.
*/
enum {
PAINT_DEFAULT = 0,
@ -1670,8 +1671,9 @@ public:
PAINT_NO_COMPOSITE = 0x08,
PAINT_COMPRESSED = 0x10
};
void PaintRoot(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
uint32_t aFlags);
already_AddRefed<LayerManager> PaintRoot(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
uint32_t aFlags);
/**
* Get the bounds. Takes the union of the bounds of all children.
* The result is not cached.

View File

@ -3124,7 +3124,8 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
flags |= nsDisplayList::PAINT_COMPRESSED;
}
list.PaintRoot(&builder, aRenderingContext, flags);
nsRefPtr<LayerManager> layerManager =
list.PaintRoot(&builder, aRenderingContext, flags);
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::DumpPaintList() || gfxUtils::sDumpPainting) {
@ -3134,14 +3135,10 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
*ss << "Painting --- after optimization:\n";
nsFrame::PrintDisplayList(&builder, list, *ss, gfxUtils::sDumpPaintingToFile);
*ss << "Painting --- retained layer tree:\n";
nsIWidget* widget = aFrame->GetNearestWidget();
if (widget) {
nsRefPtr<LayerManager> layerManager = widget->GetLayerManager();
if (layerManager) {
FrameLayerBuilder::DumpRetainedLayerTree(layerManager, *ss,
gfxUtils::sDumpPaintingToFile);
}
*ss << "Painting --- layer tree:\n";
if (layerManager) {
FrameLayerBuilder::DumpRetainedLayerTree(layerManager, *ss,
gfxUtils::sDumpPaintingToFile);
}
if (gfxUtils::sDumpPaintingToFile) {
*ss << "</body></html>";
@ -3177,12 +3174,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
}
if (builder.WillComputePluginGeometry()) {
nsRefPtr<LayerManager> layerManager;
nsIWidget* widget = aFrame->GetNearestWidget();
if (widget) {
layerManager = widget->GetLayerManager();
}
rootPresContext->ComputePluginGeometryUpdates(aFrame, &builder, &list);
// We're not going to get a WillPaintWindow event here if we didn't do

View File

@ -5255,7 +5255,9 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
ctx->SetMatrix(initialTM.Translate(rootOffset));
aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
nsRegion visible(aArea);
rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, &rc, nsDisplayList::PAINT_DEFAULT);
nsRefPtr<LayerManager> layerManager =
rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, &rc,
nsDisplayList::PAINT_DEFAULT);
aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y);
}