besser82 / rpms / firefox

Forked from rpms/firefox 5 years ago
Clone

Blame mozilla-1447775.patch

f4af4b7
f4af4b7
# HG changeset patch
f4af4b7
# User Martin Stransky <stransky@redhat.com>
f4af4b7
# Date 1523525760 -7200
f4af4b7
# Node ID 6654f42bc0e615e3fd2328d23b4a2283cad9ad45
f4af4b7
# Parent  b4bc6b2401738b78fd47127a4c716bb9178e1a09
f4af4b7
Bug 1447775 - Change persist mode immediately after sizemodechange change, r?jimm
f4af4b7
f4af4b7
Recently the window sizemode attribute is updated with 500ms delay (on Linux). It causes race condition
f4af4b7
between reflow/CSS rule and window resize callbacks and also causes visual glitch when toolbar dragspace
f4af4b7
is enabled.
f4af4b7
f4af4b7
TabsToolbar height is used at resize callback to do dragspace calculation. It has old values here
f4af4b7
because it depends on 'window[sizemode="normal"] #TabsToolbar' css rule which is applied with 500ms delay.
f4af4b7
f4af4b7
So we use old TabsToolbar height for the dragspace, then the sizemode us updated by PersistenceTimer and
f4af4b7
a new TabsToolbar height is calculated but the dragspace size stays as we're not notified
f4af4b7
about the TabsToolbar height update.
f4af4b7
f4af4b7
MozReview-Commit-ID: AiensY5LMDO
f4af4b7
f4af4b7
diff --git a/xpfe/appshell/nsWebShellWindow.cpp b/xpfe/appshell/nsWebShellWindow.cpp
f4af4b7
--- a/xpfe/appshell/nsWebShellWindow.cpp
f4af4b7
+++ b/xpfe/appshell/nsWebShellWindow.cpp
f4af4b7
@@ -350,20 +350,16 @@ nsWebShellWindow::SizeModeChanged(nsSize
f4af4b7
   if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
f4af4b7
     uint32_t zLevel;
f4af4b7
     GetZLevel(&zLevel);
f4af4b7
     if (zLevel > nsIXULWindow::normalZ)
f4af4b7
       SetZLevel(nsIXULWindow::normalZ);
f4af4b7
   }
f4af4b7
   mWindow->SetSizeMode(sizeMode);
f4af4b7
 
f4af4b7
-  // Persist mode, but not immediately, because in many (all?)
f4af4b7
-  // cases this will merge with the similar call in NS_SIZE and
f4af4b7
-  // write the attribute values only once.
f4af4b7
-  SetPersistenceTimer(PAD_MISC);
f4af4b7
   nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
f4af4b7
     mDocShell ? mDocShell->GetWindow() : nullptr;
f4af4b7
   if (ourWindow) {
f4af4b7
     // Ensure that the fullscreen state is synchronized between
f4af4b7
     // the widget and the outer window object.
f4af4b7
     if (sizeMode == nsSizeMode_Fullscreen) {
f4af4b7
       ourWindow->SetFullScreen(true);
f4af4b7
     }
f4af4b7
@@ -384,16 +380,22 @@ nsWebShellWindow::SizeModeChanged(nsSize
f4af4b7
     ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("sizemodechange"));
f4af4b7
   }
f4af4b7
 
f4af4b7
   nsIPresShell* presShell;
f4af4b7
   if ((presShell = GetPresShell())) {
f4af4b7
     presShell->GetPresContext()->SizeModeChanged(sizeMode);
f4af4b7
   }
f4af4b7
 
f4af4b7
+  // Persist mode immediately as the timer causes race condition
f4af4b7
+  // between css rules dependent on window sizemode and
f4af4b7
+  // sizemodechange/resize listener which calculates TabsToolbar height.
f4af4b7
+  PersistentAttributesDirty(PAD_MISC);
f4af4b7
+  SavePersistentAttributes();
f4af4b7
+
f4af4b7
   // Note the current implementation of SetSizeMode just stores
f4af4b7
   // the new state; it doesn't actually resize. So here we store
f4af4b7
   // the state and pass the event on to the OS. The day is coming
f4af4b7
   // when we'll handle the event here, and the return result will
f4af4b7
   // then need to be different.
f4af4b7
 }
f4af4b7
 
f4af4b7
 void
f4af4b7