Bug 1325590 - Get rid of LAYER_SVG_EFFECT in nsDisplayMask. draft
authorcku <cku@mozilla.com>
Wed, 28 Dec 2016 13:07:10 +0800
changeset 454083 e26d91a3b7b9667719db4592597ef709dc247697
parent 454082 dccfc624915b1bebe7975076e9b42bd46684cbc6
child 540618 c7f89f744e1c5a51cd94784c622125786d0568c1
push id39834
push usercku@mozilla.com
push dateWed, 28 Dec 2016 05:26:50 +0000
bugs1325590
milestone53.0a1
Bug 1325590 - Get rid of LAYER_SVG_EFFECT in nsDisplayMask. MozReview-Commit-ID: Jni6G3R5rt
layout/painting/FrameLayerBuilder.cpp
layout/painting/nsDisplayList.cpp
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -3863,18 +3863,16 @@ ContainerState::SetupMaskLayerForScrolle
   }
   return Nothing();
 }
 
 void
 ContainerState::SetupMaskLayerForCSSMask(Layer* aLayer,
                                          nsDisplayMask* aMaskItem)
 {
-  MOZ_ASSERT(mManager->IsCompositingCheap());
-
   RefPtr<ImageLayer> maskLayer =
     CreateOrRecycleMaskImageLayerFor(MaskLayerKey(aLayer, Nothing()),
       [](Layer* aMaskLayer)
       {
         aMaskLayer->SetUserData(&gCSSMaskLayerUserData,
                                 new CSSMaskLayerUserData());
       }
     );
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4572,21 +4572,21 @@ void nsDisplayWrapList::Paint(nsDisplayL
  * and they all have the expected animated geometry root.
  */
 static LayerState
 RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
                               LayerManager* aManager,
                               const ContainerLayerParameters& aParameters,
                               const nsDisplayList& aList,
                               AnimatedGeometryRoot* aExpectedAnimatedGeometryRootForChildren,
-                              LayerState aDefaultState = LAYER_INACTIVE)
-{
-  LayerState result = aDefaultState;
+                              bool aActiveIfChildAGRIsNotTheSame = true)
+{
+  LayerState result = LAYER_INACTIVE;
   for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
-    if (result == LAYER_INACTIVE &&
+    if (aActiveIfChildAGRIsNotTheSame &&
         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
@@ -4603,17 +4603,18 @@ RequiredLayerStateForChildren(nsDisplayL
     if (state == LAYER_ACTIVE_EMPTY && state > result) {
       result = LAYER_ACTIVE_FORCE;
     }
     if (state == LAYER_NONE) {
       nsDisplayList* list = i->GetSameCoordinateSystemChildren();
       if (list) {
         LayerState childState =
           RequiredLayerStateForChildren(aBuilder, aManager, aParameters, *list,
-              aExpectedAnimatedGeometryRootForChildren);
+              aExpectedAnimatedGeometryRootForChildren,
+              aActiveIfChildAGRIsNotTheSame);
         if (childState > result) {
           result = childState;
         }
       }
     }
   }
   return result;
 }
@@ -7330,23 +7331,21 @@ nsDisplayMask::PaintMask(nsDisplayListBu
   return (result == image::DrawResult::SUCCESS) ? true : false;
 }
 
 LayerState
 nsDisplayMask::GetLayerState(nsDisplayListBuilder* aBuilder,
                              LayerManager* aManager,
                              const ContainerLayerParameters& aParameters)
 {
-  if (ShouldPaintOnMaskLayer(aManager)) {
-    return RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
+  return ShouldPaintOnMaskLayer(aManager)
+         ? RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
                                          mList, GetAnimatedGeometryRoot(),
-                                         LAYER_SVG_EFFECTS);
-  }
-
-  return LAYER_SVG_EFFECTS;
+                                         false)
+         : LAYER_ACTIVE;
 }
 
 bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager)
 {
   if (!aManager->IsCompositingCheap()) {
     return false;
   }