Bug 1440690 - Don't build WebRender display list if the gecko display list hasn't changed r=kats

MozReview-Commit-ID: BQidturR8x8

--HG--
extra : rebase_source : f773a40c19c9c698fc81121413fbc36605d3ec4a
This commit is contained in:
Miko Mynttinen 2018-04-09 16:53:38 +02:00
parent 98fd9cb926
commit 09ad9f120d

View File

@ -2624,35 +2624,44 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
}
}
// 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);
}
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);
}
bool prevIsCompositingCheap =
aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
MaybeSetupTransactionIdAllocator(layerManager, presContext);
bool temp = aBuilder->SetIsCompositingCheap(layerManager->IsCompositingCheap());
wrManager->EndTransactionWithoutLayer(this, aBuilder, wrFilters);
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);
}
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.
@ -2664,7 +2673,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
frame->ClearInvalidationStateBits();
}
aBuilder->SetIsCompositingCheap(temp);
aBuilder->SetIsCompositingCheap(prevIsCompositingCheap);
if (document && widgetTransaction) {
TriggerPendingAnimations(document, layerManager->GetAnimationReadyTime());
}