Bug 1422032 - Clear the invalidation state bits for fallback items only but not for all frames. r=jrmuizel draft
authorEthan Lin <ethlin@mozilla.com>
Fri, 01 Dec 2017 16:50:04 +0800
changeset 706127 f3de6b8704bd4c2495fc82b288dffcf4b5fba3d2
parent 705442 38f49346a200cc25492236c7b3c536fc835fe031
child 742595 38ed701627b67db81b7c4e8e45903b3480f1053e
push id91728
push userbmo:ethlin@mozilla.com
push dateFri, 01 Dec 2017 11:35:52 +0000
reviewersjrmuizel
bugs1422032
milestone59.0a1
Bug 1422032 - Clear the invalidation state bits for fallback items only but not for all frames. r=jrmuizel MozReview-Commit-ID: 7rYB4hz75DG
gfx/layers/wr/WebRenderCommandBuilder.cpp
layout/painting/nsDisplayList.cpp
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -551,16 +551,20 @@ WebRenderCommandBuilder::GenerateFallbac
         invalidRegion.OrWith(lastBounds);
         invalidRegion.OrWith(paintBounds);
       }
     }
     needPaint = !invalidRegion.IsEmpty();
   }
 
   if (needPaint || !fallbackData->GetKey()) {
+    // Clear invalidation state bit for fallback item since
+    // we don't need to clear for whole frame tree.
+    aItem->Frame()->ClearInvalidationStateBits();
+
     gfx::SurfaceFormat format = aItem->GetType() == DisplayItemType::TYPE_MASK ?
                                                       gfx::SurfaceFormat::A8 : gfx::SurfaceFormat::B8G8R8A8;
     if (useBlobImage) {
       bool snapped;
       bool isOpaque = aItem->GetOpaqueRegion(aDisplayListBuilder, &snapped).Contains(paintBounds);
 
       RefPtr<gfx::DrawEventRecorderMemory> recorder = MakeAndAddRef<gfx::DrawEventRecorderMemory>([&] (MemStream &aStream, std::vector<RefPtr<UnscaledFont>> &aUnscaledFonts) {
           size_t count = aUnscaledFonts.size();
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2416,26 +2416,16 @@ already_AddRefed<LayerManager> nsDisplay
     }
 
     WebRenderLayerManager* wrManager = static_cast<WebRenderLayerManager*>(layerManager.get());
 
     MaybeSetupTransactionIdAllocator(layerManager, presContext);
     bool temp = aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
     wrManager->EndTransactionWithoutLayer(this, aBuilder);
 
-    // For layers-free mode, we check the invalidation state bits in the EndTransaction.
-    // So we clear the invalidation state bits after EndTransaction.
-    if (widgetTransaction ||
-        // SVG-as-an-image docs don't paint as part of the retained layer tree,
-        // but they still need the invalidation state bits cleared in order for
-        // invalidation for CSS/SMIL animation to work properly.
-        (document && document->IsBeingUsedAsImage())) {
-      frame->ClearInvalidationStateBits();
-    }
-
     aBuilder->SetIsCompositingCheap(temp);
     if (document && widgetTransaction) {
       TriggerPendingAnimations(document, layerManager->GetAnimationReadyTime());
     }
 
     if (presContext->RefreshDriver()->HasScheduleFlush()) {
       presContext->NotifyInvalidation(layerManager->GetLastTransactionId(), frame->GetRect());
     }