Bug 1258904 - Part 1: Don't create layers for compositor animations if the layer size is less than 16x16. r?mattwoodrow
MozReview-Commit-ID: Kb26GeYYr9D
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -4262,22 +4262,24 @@ IsItemTooSmallForActiveLayer(nsDisplayIt
static const int MIN_ACTIVE_LAYER_SIZE_DEV_PIXELS = 16;
return visibleDevPixels.Size() <
nsIntSize(MIN_ACTIVE_LAYER_SIZE_DEV_PIXELS, MIN_ACTIVE_LAYER_SIZE_DEV_PIXELS);
}
bool
nsDisplayOpacity::NeedsActiveLayer(nsDisplayListBuilder* aBuilder)
{
- if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_opacity) &&
- !IsItemTooSmallForActiveLayer(this))
- return true;
- if (EffectCompositor::HasAnimationsForCompositor(mFrame,
+ if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame,
+ eCSSProperty_opacity) ||
+ EffectCompositor::HasAnimationsForCompositor(mFrame,
eCSSProperty_opacity)) {
- return true;
+ if (!IsItemTooSmallForActiveLayer(this)) {
+ return true;
+ }
+ // FIXME: Set animation performance warning here.
}
return false;
}
void
nsDisplayOpacity::ApplyOpacity(nsDisplayListBuilder* aBuilder,
float aOpacity,
const DisplayItemClip* aClip)
@@ -5924,22 +5926,25 @@ already_AddRefed<Layer> nsDisplayTransfo
return container.forget();
}
bool
nsDisplayTransform::MayBeAnimated(nsDisplayListBuilder* aBuilder)
{
// Here we check if the *post-transform* bounds of this item are big enough
// to justify an active layer.
- if (ActiveLayerTracker::IsStyleAnimated(aBuilder, mFrame, eCSSProperty_transform) &&
- !IsItemTooSmallForActiveLayer(this))
- return true;
- if (EffectCompositor::HasAnimationsForCompositor(mFrame,
+ if (ActiveLayerTracker::IsStyleAnimated(aBuilder,
+ mFrame,
+ eCSSProperty_transform) ||
+ EffectCompositor::HasAnimationsForCompositor(mFrame,
eCSSProperty_transform)) {
- return true;
+ if (!IsItemTooSmallForActiveLayer(this)) {
+ return true;
+ }
+ // FIXME: Set animation performance warning here.
}
return false;
}
nsDisplayItem::LayerState
nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters) {