diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 1758ebae7852..812f8b6256c2 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3210,6 +3210,25 @@ TabChild::InvalidateLayers() FrameLayerBuilder::InvalidateAllLayers(lm); } +void +TabChild::SchedulePaint() +{ + nsCOMPtr docShell = do_GetInterface(WebNavigation()); + if (!docShell) { + return; + } + + // We don't use TabChildBase::GetPresShell() here because that would create + // a content viewer if one doesn't exist yet. Creating a content viewer can + // cause JS to run, which we want to avoid. nsIDocShell::GetPresShell + // returns null if no content viewer exists yet. + if (nsCOMPtr presShell = docShell->GetPresShell()) { + if (nsIFrame* root = presShell->GetRootFrame()) { + root->SchedulePaint(); + } + } +} + void TabChild::ReinitRendering() { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 7a0a9293eabb..d26c9dbbd53c 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -540,6 +540,7 @@ public: void ClearCachedResources(); void InvalidateLayers(); + void SchedulePaint(); void ReinitRendering(); void ReinitRenderingForDeviceReset(); diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index cda2296f0799..3e7aa247e7c9 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -561,6 +561,12 @@ WebRenderLayerManager::WrUpdated() { mWebRenderCommandBuilder.ClearCachedResources(); DiscardLocalImages(); + + if (mWidget) { + if (dom::TabChild* tabChild = mWidget->GetOwningTabChild()) { + tabChild->SchedulePaint(); + } + } } dom::TabGroup*