Bug 625672. Part 2: Build temporary layer manager to render inactive layers after we've recomputed visibility. r=tnikkel,a=blocker

This commit is contained in:
Robert O'Callahan 2011-02-10 21:58:11 +13:00
Родитель fbd3214a6c
Коммит 92ce1d33f3
4 изменённых файлов: 36 добавлений и 32 удалений

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

@ -1176,21 +1176,19 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
return layer.forget();
}
static already_AddRefed<BasicLayerManager>
BuildTempManagerForInactiveLayer(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem)
static void
PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem,
gfxContext* aContext)
{
// This item has an inactive layer. We will render it to a ThebesLayer
// using a temporary BasicLayerManager. Set up the layer
// manager now so that if we need to modify the retained layer
// tree during this process, those modifications will happen
// during the construction phase for the retained layer tree.
// This item has an inactive layer. Render it to a ThebesLayer
// using a temporary BasicLayerManager.
nsRefPtr<BasicLayerManager> tempManager = new BasicLayerManager();
tempManager->BeginTransaction();
tempManager->BeginTransactionWithTarget(aContext);
nsRefPtr<Layer> layer = aItem->BuildLayer(aBuilder, tempManager);
if (!layer) {
tempManager->EndTransaction(nsnull, nsnull);
return nsnull;
return;
}
PRInt32 appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem);
nsIntRect itemVisibleRect =
@ -1198,9 +1196,7 @@ BuildTempManagerForInactiveLayer(nsDisplayListBuilder* aBuilder,
SetVisibleRectForLayer(layer, itemVisibleRect);
tempManager->SetRoot(layer);
// No painting should occur yet, since there is no target context.
tempManager->EndTransaction(nsnull, nsnull);
return tempManager.forget();
tempManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
}
/*
@ -1301,13 +1297,6 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
mNewChildLayers.AppendElement(ownLayer);
mBuilder->LayerBuilder()->AddLayerDisplayItem(ownLayer, item);
} else {
nsRefPtr<BasicLayerManager> tempLayerManager;
if (layerState != LAYER_NONE) {
tempLayerManager = BuildTempManagerForInactiveLayer(mBuilder, item);
if (!tempLayerManager)
continue;
}
nsIFrame* f = item->GetUnderlyingFrame();
nsIFrame* activeScrolledRoot =
nsLayoutUtils::GetActiveScrolledRootFor(f, mBuilder->ReferenceFrame());
@ -1331,7 +1320,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
mBuilder->LayerBuilder()->
AddThebesDisplayItem(thebesLayer, item, aClip, mContainerFrame,
layerState, tempLayerManager);
layerState);
}
}
}
@ -1392,8 +1381,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
nsDisplayItem* aItem,
const Clip& aClip,
nsIFrame* aContainerLayerFrame,
LayerState aLayerState,
LayerManager* aTempManager)
LayerState aLayerState)
{
AddLayerDisplayItem(aLayer, aItem);
@ -1403,7 +1391,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer,
NS_ASSERTION(aItem->GetUnderlyingFrame(), "Must have frame");
ClippedDisplayItem* cdi =
entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip));
cdi->mTempLayerManager = aTempManager;
cdi->mInactiveLayer = aLayerState != LAYER_NONE;
}
}
@ -1878,11 +1866,8 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
}
}
if (cdi->mTempLayerManager) {
// This item has an inactive layer. Render it to the ThebesLayer
// using the temporary BasicLayerManager.
cdi->mTempLayerManager->BeginTransactionWithTarget(aContext);
cdi->mTempLayerManager->EndTransaction(DrawThebesLayer, builder);
if (cdi->mInactiveLayer) {
PaintInactiveLayer(builder, cdi->mItem, aContext);
} else {
cdi->mItem->Paint(builder, rc);
}

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

@ -238,8 +238,7 @@ public:
nsDisplayItem* aItem,
const Clip& aClip,
nsIFrame* aContainerLayerFrame,
LayerState aLayerState,
LayerManager* aTempManager);
LayerState aLayerState);
/**
* Given a frame and a display item key that uniquely identifies a
@ -430,8 +429,8 @@ protected:
}
nsDisplayItem* mItem;
nsRefPtr<LayerManager> mTempLayerManager;
Clip mClip;
PRPackedBool mInactiveLayer;
};
/**

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

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<head>
<style>
p { margin:0; }
</style>
</head>
<body style="overflow:hidden;">
<div style="position: fixed; bottom: 0; z-index: 1; width: 100%; height: 50px; background-color: black;"></div>
<div style="-moz-transform: scale(1);">
<script>
for (var i = 1; i <= 100; ++i) {
document.write("<p>This is some text: " + i + "\n");
}
</script>
</div>
<script src="scrolling.js"></script>
</body>
</html>

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

@ -1,6 +1,7 @@
HTTP == fixed-1.html fixed-1.html?ref
HTTP == fixed-opacity-1.html fixed-opacity-1.html?ref
HTTP == fixed-text-1.html fixed-text-1.html?ref
HTTP == fixed-text-2.html fixed-text-2.html?ref
HTTP == opacity-mixed-scrolling-1.html opacity-mixed-scrolling-1.html?ref
random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357
HTTP == simple-1.html simple-1.html?ref