Bug 1440690 - Don't build WebRender display list if the gecko display list hasn't changed
MozReview-Commit-ID: BQidturR8x8
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2619,57 +2619,66 @@ already_AddRefed<LayerManager> nsDisplay
}
} else {
if (!layerManager->BeginTransaction()) {
return nullptr;
}
}
}
- // Windowed plugins are not supported with WebRender enabled.
- // But PluginGeometry needs to be updated to show plugin.
- // Windowed plugins are going to be removed by Bug 1296400.
- nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
- if (rootPresContext && XRE_IsContentProcess()) {
- if (aBuilder->WillComputePluginGeometry()) {
- rootPresContext->ComputePluginGeometryUpdates(aBuilder->RootReferenceFrame(), aBuilder, this);
+ bool prevIsCompositingCheap =
+ aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
+ MaybeSetupTransactionIdAllocator(layerManager, presContext);
+
+ bool sent = false;
+ if (aFlags & PAINT_IDENTICAL_DISPLAY_LIST) {
+ sent = layerManager->EndEmptyTransaction();
+ }
+
+ if (!sent) {
+ // Windowed plugins are not supported with WebRender enabled.
+ // But PluginGeometry needs to be updated to show plugin.
+ // Windowed plugins are going to be removed by Bug 1296400.
+ nsRootPresContext* rootPresContext = presContext->GetRootPresContext();
+ if (rootPresContext && XRE_IsContentProcess()) {
+ if (aBuilder->WillComputePluginGeometry()) {
+ rootPresContext->ComputePluginGeometryUpdates(aBuilder->RootReferenceFrame(), aBuilder, this);
+ }
+ // This must be called even if PluginGeometryUpdates were not computed.
+ rootPresContext->CollectPluginGeometryUpdates(layerManager);
}
- // This must be called even if PluginGeometryUpdates were not computed.
- rootPresContext->CollectPluginGeometryUpdates(layerManager);
- }
-
- WebRenderLayerManager* wrManager = static_cast<WebRenderLayerManager*>(layerManager.get());
-
- nsIDocShell* docShell = presContext->GetDocShell();
- nsTArray<wr::WrFilterOp> wrFilters;
- gfx::Matrix5x4* colorMatrix = nsDocShell::Cast(docShell)->GetColorMatrix();
- if (colorMatrix) {
- wr::WrFilterOp gs = {
- wr::WrFilterOpType::ColorMatrix
- };
- MOZ_ASSERT(sizeof(gs.matrix) == sizeof(colorMatrix->components));
- memcpy(&(gs.matrix), colorMatrix->components, sizeof(gs.matrix));
- wrFilters.AppendElement(gs);
- }
-
- MaybeSetupTransactionIdAllocator(layerManager, presContext);
- bool temp = aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
- wrManager->EndTransactionWithoutLayer(this, aBuilder, wrFilters);
+
+ WebRenderLayerManager* wrManager = static_cast<WebRenderLayerManager*>(layerManager.get());
+
+ nsIDocShell* docShell = presContext->GetDocShell();
+ nsTArray<wr::WrFilterOp> wrFilters;
+ gfx::Matrix5x4* colorMatrix = nsDocShell::Cast(docShell)->GetColorMatrix();
+ if (colorMatrix) {
+ wr::WrFilterOp gs = {
+ wr::WrFilterOpType::ColorMatrix
+ };
+ MOZ_ASSERT(sizeof(gs.matrix) == sizeof(colorMatrix->components));
+ memcpy(&(gs.matrix), colorMatrix->components, sizeof(gs.matrix));
+ wrFilters.AppendElement(gs);
+ }
+
+ wrManager->EndTransactionWithoutLayer(this, aBuilder, wrFilters);
+ }
// 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);
+ aBuilder->SetIsCompositingCheap(prevIsCompositingCheap);
if (document && widgetTransaction) {
TriggerPendingAnimations(document, layerManager->GetAnimationReadyTime());
}
if (presContext->RefreshDriver()->HasScheduleFlush()) {
presContext->NotifyInvalidation(layerManager->GetLastTransactionId(), frame->GetRect());
}