Bug 1248913 - Make nsDisplayBlendContainer active or inactive based on its contents. r=mattwoodrow a=ritu
☠☠ backed out by e32863fa1eef ☠ ☠
authorMarkus Stange <mstange@themasta.com>
Tue, 08 Mar 2016 14:39:07 -0500
changeset 323566 80a726021cd025a3e4b39dc183a52dbc408c4dc8
parent 323565 f1e83e40ce0bbbc89d4521c53560507b4ea3e02e
child 323567 50a0eb35d60ab34273dfb14d8513522c73c5b6ec
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [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