Bug 1258904 - Part 2: nsDisplay(Opacity|Transform)::GetLayerState should return LAYER_ACTIVE_FORCE if they have async animations to avoid flattening the layers. draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Sat, 07 May 2016 17:37:57 +0900
changeset 364659 2dfc3de5a5a03480e10e5f366cf9261c91de6d27
parent 364658 ee2925fbbf4231baf8fd3a823e809fb921b7b8a6
child 364660 09d44fc8b6b9cf071e477f6a246ac381bd07edca
push id17525
push userhiikezoe@mozilla-japan.org
push dateSat, 07 May 2016 10:01:04 +0000
bugs1258904
milestone49.0a1
Bug 1258904 - Part 2: nsDisplay(Opacity|Transform)::GetLayerState should return LAYER_ACTIVE_FORCE if they have async animations to avoid flattening the layers. MozReview-Commit-ID: 16QtFJBX97W
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -4357,18 +4357,21 @@ nsDisplayOpacity::GetLayerState(nsDispla
   // If we only created this item so that we'd get correct nsDisplayEventRegions for child
   // frames, then force us to inactive to avoid unnecessary layerization changes for content
   // that won't ever be painted.
   if (mForEventsOnly) {
     MOZ_ASSERT(mOpacity == 0);
     return LAYER_INACTIVE;
   }
 
-  if (NeedsActiveLayer(aBuilder))
-    return LAYER_ACTIVE;
+  if (NeedsActiveLayer(aBuilder)) {
+    // Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
+    // animations.
+    return LAYER_ACTIVE_FORCE;
+  }
 
   return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, GetAnimatedGeometryRoot());
 }
 
 bool
 nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                     nsRegion* aVisibleRegion) {
   // Our children are translucent so we should not allow them to subtract
@@ -5950,18 +5953,21 @@ nsDisplayTransform::GetLayerState(nsDisp
                                   const ContainerLayerParameters& aParameters) {
   // If the transform is 3d, the layer takes part in preserve-3d
   // sorting, or the layer is a separator then we *always* want this
   // to be an active layer.
   if (!GetTransform().Is2D() || mFrame->Combines3DTransformWithAncestors() ||
       mIsTransformSeparator) {
     return LAYER_ACTIVE_FORCE;
   }
+
   if (MayBeAnimated(aBuilder)) {
-    return LAYER_ACTIVE;
+    // Returns LAYER_ACTIVE_FORCE to avoid flatterning the layer for async
+    // animations.
+    return LAYER_ACTIVE_FORCE;
   }
 
   const nsStyleDisplay* disp = mFrame->StyleDisplay();
   if ((disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM)) {
     return LAYER_ACTIVE;
   }
 
   // Expect the child display items to have this frame as their animated