Bug 1368386 - Add PaintedLayer::InvalidateWholeLayer(). r?mattwoodrow draft
authorMarkus Stange <mstange@themasta.com>
Thu, 15 Jun 2017 17:29:18 -0400
changeset 595033 af414960e760cd9250ff2bc7dc5a2c2620198fac
parent 595032 51806cc4e056f5439a20136f55ff10dadfe64677
child 595034 a8ce8f26acd2931e1a2ae8c50c95788e54116a0c
push id64223
push userbmo:mstange@themasta.com
push dateThu, 15 Jun 2017 22:26:05 +0000
reviewersmattwoodrow
bugs1368386
milestone56.0a1
Bug 1368386 - Add PaintedLayer::InvalidateWholeLayer(). r?mattwoodrow MozReview-Commit-ID: 7sgQDs82Wwt
gfx/layers/Layers.h
layout/painting/FrameLayerBuilder.cpp
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2000,16 +2000,21 @@ public:
     Mutated();
   }
 
   /**
    * Can be used anytime
    */
   const nsIntRegion& GetValidRegion() const { return mValidRegion; }
 
+  void InvalidateWholeLayer()
+  {
+    InvalidateRegion(GetValidRegion().GetBounds());
+  }
+
   virtual PaintedLayer* AsPaintedLayer() override { return this; }
 
   MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_PAINTED)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
   {
     gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
     gfx::Matrix residual;
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -2268,18 +2268,17 @@ ResetScrollPositionForLayerPixelAlignmen
 static void
 InvalidateEntirePaintedLayer(PaintedLayer* aLayer, AnimatedGeometryRoot* aAnimatedGeometryRoot, const char *aReason)
 {
 #ifdef MOZ_DUMP_PAINTING
   if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
     printf_stderr("Invalidating entire layer %p: %s\n", aLayer, aReason);
   }
 #endif
-  nsIntRect invalidate = aLayer->GetValidRegion().GetBounds();
-  aLayer->InvalidateRegion(invalidate);
+  aLayer->InvalidateWholeLayer();
   aLayer->SetInvalidRectToVisibleRegion();
   ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
 }
 
 LayerManager::PaintedLayerCreationHint
 ContainerState::GetLayerCreationHint(AnimatedGeometryRoot* aAnimatedGeometryRoot)
 {
   // Check whether the layer will be scrollable. This is used as a hint to
@@ -3201,17 +3200,17 @@ void ContainerState::FinishPaintedLayerD
       newLayerEntry->mClipChain = paintedLayerEntry->mClipChain;
       newLayerEntry->mScrollMetadataASR = paintedLayerEntry->mScrollMetadataASR;
 
       // Hide the PaintedLayer. We leave it in the layer tree so that we
       // can find and recycle it later.
       ParentLayerIntRect emptyRect;
       data->mLayer->SetClipRect(Some(emptyRect));
       data->mLayer->SetVisibleRegion(LayerIntRegion());
-      data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion().GetBounds());
+      data->mLayer->InvalidateWholeLayer();
       data->mLayer->SetEventRegions(EventRegions());
 
       for (auto& item : data->mAssignedDisplayItems) {
         mLayerBuilder->StoreOptimizedLayerForFrame(item.mItem, layer);
       }
     }
   }
 
@@ -3267,17 +3266,17 @@ void ContainerState::FinishPaintedLayerD
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("Forced background color has changed from #%08X to #%08X on layer %p\n",
                       userData->mForcedBackgroundColor, backgroundColor, data->mLayer);
         nsAutoCString str;
         AppendToString(str, data->mLayer->GetValidRegion());
         printf_stderr("Invalidating layer %p: %s\n", data->mLayer, str.get());
       }
 #endif
-      data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion());
+      data->mLayer->InvalidateWholeLayer();
     }
     userData->mForcedBackgroundColor = backgroundColor;
 
     userData->mFontSmoothingBackgroundColor = data->mFontSmoothingBackgroundColor;
 
     // use a mask layer for rounded rect clipping.
     // data->mCommonClipCount may be -1 if we haven't put any actual
     // drawable items in this layer (i.e. it's only catching events).
@@ -6346,17 +6345,17 @@ ContainerState::SetupMaskLayer(Layer *aL
 {
   // if the number of clips we are going to mask has decreased, then aLayer might have
   // cached graphics which assume the existence of a soon-to-be non-existent mask layer
   // in that case, invalidate the whole layer.
   PaintedDisplayItemLayerUserData* paintedData = GetPaintedDisplayItemLayerUserData(aLayer);
   if (paintedData &&
       aRoundedRectClipCount < paintedData->mMaskClipCount) {
     PaintedLayer* painted = aLayer->AsPaintedLayer();
-    painted->InvalidateRegion(painted->GetValidRegion().GetBounds());
+    painted->InvalidateWholeLayer();
   }
 
   // don't build an unnecessary mask
   if (aClip.GetRoundedRectCount() == 0 ||
       aRoundedRectClipCount == 0) {
     SetClipCount(paintedData, 0);
     return;
   }