Bug 1258904 - Part 1: Don't create layers for compositor animations if the layer size is less than 16x16. r?mattwoodrow draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Sat, 07 May 2016 17:37:57 +0900
changeset 364658 ee2925fbbf4231baf8fd3a823e809fb921b7b8a6
parent 364657 e6c18e5eb465c7119835f7e8843ec511eb629f78
child 364659 2dfc3de5a5a03480e10e5f366cf9261c91de6d27
push id17525
push userhiikezoe@mozilla-japan.org
push dateSat, 07 May 2016 10:01:04 +0000
reviewersmattwoodrow
bugs1258904
milestone49.0a1
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
layout/base/nsDisplayList.cpp
--- 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) {