Commit 344bced3 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1832384 - Don't rollup with animations in some cases. r=handyman

If we rollup with animations but get occluded right away, we might not
advance the refresh driver enough for the animation to finish.

Tentative patch, as I wasn't able to reproduce this... But we've seen
similar issues in other OSes, see bug 1810797.

Differential Revision: https://phabricator.services.mozilla.com/D177934
parent a7526d2a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -8325,6 +8325,9 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
  bool consumeRollupEvent = false;
  Maybe<POINT> touchPoint;  // In screen coords.

  // If we rollup with animations but get occluded right away, we might not
  // advance the refresh driver enough for the animation to finish.
  auto allowAnimations = nsIRollupListener::AllowAnimations::Yes;
  nsWindow* popupWindow = static_cast<nsWindow*>(popup.get());
  UINT nativeMessage = WinUtils::GetNativeMessage(aMessage);
  switch (nativeMessage) {
@@ -8405,6 +8408,7 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
      return consumeRollupEvent;

    case WM_ACTIVATEAPP:
      allowAnimations = nsIRollupListener::AllowAnimations::No;
      break;

    case WM_ACTIVATE:
@@ -8468,6 +8472,7 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
          return false;
        }
      }
      allowAnimations = nsIRollupListener::AllowAnimations::No;
      break;

    case MOZ_WM_REACTIVATE:
@@ -8532,6 +8537,7 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
    case WM_SHOWWINDOW:
      // If the window is being minimized, close popups.
      if (aLParam == SW_PARENTCLOSING) {
        allowAnimations = nsIRollupListener::AllowAnimations::No;
        break;
      }
      return false;
@@ -8540,6 +8546,7 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
      // If focus moves to other window created in different process/thread,
      // e.g., a plugin window, popups should be rolled up.
      if (IsDifferentThreadWindow(reinterpret_cast<HWND>(aWParam))) {
        allowAnimations = nsIRollupListener::AllowAnimations::No;
        break;
      }
      return false;
@@ -8558,6 +8565,8 @@ bool nsWindow::DealWithPopups(HWND aWnd, UINT aMessage, WPARAM aWParam,
  nsIRollupListener::RollupOptions rollupOptions{
      popupsToRollup,
      nsIRollupListener::FlushViews::Yes,
      /* mPoint = */ nullptr,
      allowAnimations,
  };

  if (nativeMessage == WM_TOUCH || nativeMessage == WM_LBUTTONDOWN ||