Bug 1248913 - Make nsDisplayBlendContainer active or inactive based on its contents. r=mattwoodrow, a=ritu
authorMarkus Stange <mstange@themasta.com>
Tue, 08 Mar 2016 14:39:07 -0500
changeset 325512 bf27bbf52e4be36dee46a9fd9fa94187a402f8bc
parent 325511 5cd28a4a829baa655ebd1b4a970727fb409fde60
child 325513 62de4de10ebbbca861118a12b90b9df867032a23
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, ritu
bugs1248913
milestone47.0a2
Bug 1248913 - Make nsDisplayBlendContainer active or inactive based on its contents. r=mattwoodrow, a=ritu MozReview-Commit-ID: GN0084Rrmlm
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -3999,16 +3999,25 @@ RequiredLayerStateForChildren(nsDisplayL
   LayerState result = LAYER_INACTIVE;
   for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
     if (result == LAYER_INACTIVE &&
         i->GetAnimatedGeometryRoot() != aExpectedAnimatedGeometryRootForChildren) {
       result = LAYER_ACTIVE;
     }
 
     LayerState state = i->GetLayerState(aBuilder, aManager, aParameters);
+    if (state == LAYER_ACTIVE && i->GetType() == nsDisplayItem::TYPE_BLEND_MODE) {
+      // nsDisplayBlendMode always returns LAYER_ACTIVE to ensure that the
+      // blending operation happens in the intermediate surface of its parent
+      // display item (usually an nsDisplayBlendContainer). But this does not
+      // mean that it needs all its ancestor display items to become active.
+      // So we ignore its layer state and look at its children instead.
+      state = RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
+        *i->GetSameCoordinateSystemChildren(), i->GetAnimatedGeometryRoot());
+    }
     if ((state == LAYER_ACTIVE || state == LAYER_ACTIVE_FORCE) &&
         state > result) {
       result = state;
     }
     if (state == LAYER_ACTIVE_EMPTY && state > result) {
       result = LAYER_ACTIVE_FORCE;
     }
     if (state == LAYER_NONE) {
@@ -4440,17 +4449,17 @@ nsDisplayBlendContainer::BuildLayer(nsDi
   return container.forget();
 }
 
 LayerState
 nsDisplayBlendContainer::GetLayerState(nsDisplayListBuilder* aBuilder,
                                        LayerManager* aManager,
                                        const ContainerLayerParameters& aParameters)
 {
-  return mozilla::LAYER_ACTIVE;
+  return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, GetAnimatedGeometryRoot());
 }
 
 bool nsDisplayBlendContainer::TryMerge(nsDisplayItem* aItem) {
   if (aItem->GetType() != TYPE_BLEND_CONTAINER)
     return false;
   // items for the same content element should be merged into a single
   // compositing group
   // aItem->GetUnderlyingFrame() returns non-null because it's nsDisplayOpacity