From e424589434e89217552dcdf06310df59cc399540 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sun, 8 Mar 2020 22:19:10 +0000 Subject: [PATCH] Bug 1620817. Invalidate when the BrowserChild gets a different visible rect. r=mattwoodrow layout/reftests/bugs/370422-1.html changes the size of a fission iframe. Bug 1615504 made sure the visible rect got to the child process. But there is still a failure mode where (I assume) all invalidations/painting of changing the document size in the iframe content process happens before the effects visible rect ipc msg arrives at the content process. In this case we still need to invalidate even though we use the correct visible rect on the builder we need a dirty rect that includes the unveiled area. Depends on D65888 Differential Revision: https://phabricator.services.mozilla.com/D65889 --HG-- extra : moz-landing-system : lando --- dom/ipc/BrowserChild.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp index e0a45eb8d2c0..9e3a1f7ae9f8 100644 --- a/dom/ipc/BrowserChild.cpp +++ b/dom/ipc/BrowserChild.cpp @@ -2814,8 +2814,33 @@ void BrowserChild::NotifyPainted() { } IPCResult BrowserChild::RecvUpdateEffects(const EffectsInfo& aEffects) { + bool needInvalidate = false; + if (mEffectsInfo.IsVisible() && aEffects.IsVisible() && + mEffectsInfo != aEffects) { + // if we are staying visible and either the visrect or scale changed we need + // to invalidate + needInvalidate = true; + } + mEffectsInfo = aEffects; UpdateVisibility(); + + if (needInvalidate) { + nsCOMPtr docShell = do_GetInterface(WebNavigation()); + if (docShell) { + // We don't use BrowserChildBase::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. + RefPtr presShell = docShell->GetPresShell(); + if (presShell) { + if (nsIFrame* root = presShell->GetRootFrame()) { + root->InvalidateFrame(); + } + } + } + } + return IPC_OK(); }