Bug 1620817. Invalidate when the BrowserChild gets a different visible rect. r=mattwoodrow
authorTimothy Nikkel <tnikkel@gmail.com>
Sun, 08 Mar 2020 22:19:10 +0000
changeset 517486 f714fc6d0d908979703f4c04961c79a808ec05fd
parent 517485 2540a369a5a8d0df5a30d56a39225435844f548d
child 517487 24dc59fa7381d59c6c72e45bd65199fb71bf3043
push id37195
push useraiakab@mozilla.com
push dateMon, 09 Mar 2020 09:18:41 +0000
treeherdermozilla-central@7ac664c14598 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1620817, 370422, 1615504
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/ipc/BrowserChild.cpp
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -2809,18 +2809,43 @@ void BrowserChild::InitAPZState() {
 void BrowserChild::NotifyPainted() {
   if (!mNotified) {
     SendNotifyCompositorTransaction();
     mNotified = true;
   }
 }
 
 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<nsIDocShell> 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> presShell = docShell->GetPresShell();
+      if (presShell) {
+        if (nsIFrame* root = presShell->GetRootFrame()) {
+          root->InvalidateFrame();
+        }
+      }
+    }
+  }
+
   return IPC_OK();
 }
 
 bool BrowserChild::IsVisible() {
   return mPuppetWidget && mPuppetWidget->IsVisible();
 }
 
 void BrowserChild::UpdateVisibility() {