Bug 913443 - Extract layer hint calculation. r=roc

--HG--
extra : rebase_source : eee7b00b69b46e106865911e58a0b06a8643980e
This commit is contained in:
Markus Stange 2015-03-02 19:24:18 -05:00
Родитель 09230009c4
Коммит 4215086d34
1 изменённых файлов: 21 добавлений и 9 удалений

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

@ -698,6 +698,9 @@ public:
protected:
friend class PaintedLayerData;
LayerManager::PaintedLayerCreationHint
GetLayerCreationHint(const nsIFrame* aAnimatedGeometryRoot);
/**
* Grab the next recyclable PaintedLayer, or create one if there are no
* more recyclable PaintedLayers. Does any necessary invalidation of
@ -1681,6 +1684,22 @@ InvalidateEntirePaintedLayer(PaintedLayer* aLayer, const nsIFrame* aAnimatedGeom
ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
}
LayerManager::PaintedLayerCreationHint
ContainerState::GetLayerCreationHint(const nsIFrame* aAnimatedGeometryRoot)
{
// Check whether the layer will be scrollable. This is used as a hint to
// influence whether tiled layers are used or not.
if (mParameters.mInLowPrecisionDisplayPort) {
return LayerManager::SCROLLABLE;
}
nsIFrame* animatedGeometryRootParent = aAnimatedGeometryRoot->GetParent();
if (animatedGeometryRootParent &&
animatedGeometryRootParent->GetType() == nsGkAtoms::scrollFrame) {
return LayerManager::SCROLLABLE;
}
return LayerManager::NONE;
}
already_AddRefed<PaintedLayer>
ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
const nsIFrame* aReferenceFrame,
@ -1694,15 +1713,8 @@ ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoo
// Check whether the layer will be scrollable. This is used as a hint to
// influence whether tiled layers are used or not.
LayerManager::PaintedLayerCreationHint creationHint = LayerManager::NONE;
if (mParameters.mInLowPrecisionDisplayPort ) {
creationHint = LayerManager::SCROLLABLE;
}
nsIFrame* animatedGeometryRootParent = aAnimatedGeometryRoot->GetParent();
if (animatedGeometryRootParent &&
animatedGeometryRootParent->GetType() == nsGkAtoms::scrollFrame) {
creationHint = LayerManager::SCROLLABLE;
}
LayerManager::PaintedLayerCreationHint creationHint =
GetLayerCreationHint(aAnimatedGeometryRoot);
if (mNextFreeRecycledPaintedLayer < mRecycledPaintedLayers.Length()) {
// Try to recycle a layer