Bug 1382314 - Fix invalidation problem for layers-free mode. r=jrmuizel draft
authorEthan Lin <ethlin@mozilla.com>
Thu, 20 Jul 2017 16:19:15 +0800
changeset 612020 0d7971abb0d9419a44ab17fa97d6232a9d07a19f
parent 612019 d9a5327ec81f6946c33d88e99181c8349ddddcee
child 638296 49cb48dea94c1afe6dc96e3d67b33f3ea1fa8dde
push id69369
push userbmo:ethlin@mozilla.com
push dateThu, 20 Jul 2017 08:22:23 +0000
reviewersjrmuizel
bugs1382314
milestone56.0a1
Bug 1382314 - Fix invalidation problem for layers-free mode. r=jrmuizel MozReview-Commit-ID: 8z03n7zmvOz
gfx/layers/wr/WebRenderLayerManager.cpp
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -375,25 +375,31 @@ WebRenderLayerManager::PushItemAsImage(n
   LayerPoint offset = ViewAs<LayerPixel>(
       LayoutDevicePoint::FromAppUnits(aItem->ToReferenceFrame() + shift, appUnitsPerDevPixel),
       PixelCastJustification::WebRenderHasUnitResolution);
 
   nsRegion invalidRegion;
   nsAutoPtr<nsDisplayItemGeometry> geometry = fallbackData->GetGeometry();
 
   if (geometry) {
-    nsPoint shift = itemBounds.TopLeft() - geometry->mBounds.TopLeft();
-    geometry->MoveBy(shift);
-    aItem->ComputeInvalidationRegion(aDisplayListBuilder, geometry, &invalidRegion);
-    nsRect lastBounds = fallbackData->GetBounds();
-    lastBounds.MoveBy(shift);
+    nsRect invalid;
+    if (aItem->IsInvalid(invalid)) {
+      invalidRegion.OrWith(clippedBounds);
+    } else {
+      nsPoint shift = itemBounds.TopLeft() - geometry->mBounds.TopLeft();
+      geometry->MoveBy(shift);
+      aItem->ComputeInvalidationRegion(aDisplayListBuilder, geometry, &invalidRegion);
 
-    if (!lastBounds.IsEqualInterior(clippedBounds)) {
-      invalidRegion.OrWith(lastBounds);
-      invalidRegion.OrWith(clippedBounds);
+      nsRect lastBounds = fallbackData->GetBounds();
+      lastBounds.MoveBy(shift);
+
+      if (!lastBounds.IsEqualInterior(clippedBounds)) {
+        invalidRegion.OrWith(lastBounds);
+        invalidRegion.OrWith(clippedBounds);
+      }
     }
   }
 
   if (!geometry || !invalidRegion.IsEmpty()) {
     if (gfxPrefs::WebRenderBlobImages()) {
       RefPtr<gfx::DrawEventRecorderMemory> recorder = MakeAndAddRef<gfx::DrawEventRecorderMemory>();
       RefPtr<gfx::DrawTarget> dummyDt =
         gfx::Factory::CreateDrawTarget(gfx::BackendType::SKIA, gfx::IntSize(1, 1), gfx::SurfaceFormat::B8G8R8X8);