Include visible region changes in the cached invalid region for ContainerLayers. (bug 1381666 part 4, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Mon, 31 Jul 2017 12:29:18 -0700
changeset 423252 c3e6fac14d49d391d4232c7a4bcd248d09b52346
parent 423251 2736371868ec427366574b77098440ed41cc0e39
child 423253 2e872bf7791da6b36486e1ce6500d536b71ed9fb
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1381666
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Include visible region changes in the cached invalid region for ContainerLayers. (bug 1381666 part 4, r=mattwoodrow)
gfx/layers/LayerTreeInvalidation.cpp
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -416,20 +416,32 @@ public:
       aCallback(container, result);
     }
 
     if (childrenChanged) {
       container->SetChildrenChanged(true);
     }
 
     if (container->UseIntermediateSurface()) {
-      IntRect bounds = invalidateWholeLayer
-                       ? mLayer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds()
-                       : result.GetBounds();
-      container->SetInvalidCompositeRect(bounds);
+      Maybe<IntRect> bounds;
+
+      if (!invalidateWholeLayer) {
+        bounds = Some(result.GetBounds());
+
+        // Process changes in the visible region.
+        IntRegion newVisible = mLayer->GetLocalVisibleRegion().ToUnknownRegion();
+        if (!newVisible.IsEqual(mVisibleRegion)) {
+          newVisible.XorWith(mVisibleRegion);
+          bounds = bounds->SafeUnion(newVisible.GetBounds());
+        }
+      }
+      if (!bounds) {
+        bounds = Some(mLayer->GetLocalVisibleRegion().GetBounds().ToUnknownRect());
+      }
+      container->SetInvalidCompositeRect(bounds.value());
     }
 
     if (!mLayer->Extend3DContext()) {
       // |result| contains invalid regions only of children.
       result.Transform(GetTransformForInvalidation(mLayer));
     }
     // else, effective transforms have applied on children.