Bug 913443 - Extract layer hint calculation. r=roc

This commit is contained in:
Markus Stange 2015-03-02 19:24:18 -05:00
parent 3e610f145e
commit 6cfa76525a

View File

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