Bug 1506050 - [Linux/Gtk] Use NS_DOCUMENT_STATE_WINDOW_INACTIVE to set titlebar state, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Tue, 20 Nov 2018 15:51:18 +0000
changeset 506460 bf1a01ae1faa2960e09228ecff32d1d332244232
parent 506459 4d353fd7da6bf1910ceb2dd4af99392c995cbaa7
child 506461 d6591e3f56bbe90561faeb01470cca02d9085e36
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1506050
milestone65.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 1506050 - [Linux/Gtk] Use NS_DOCUMENT_STATE_WINDOW_INACTIVE to set titlebar state, r=jhorak Differential Revision: https://phabricator.services.mozilla.com/D12104
widget/gtk/nsNativeThemeGTK.cpp
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -455,21 +455,18 @@ nsNativeThemeGTK::GetGtkWidgetAndState(S
       }
     }
 
     if (aAppearance == StyleAppearance::MozWindowTitlebar ||
         aAppearance == StyleAppearance::MozWindowTitlebarMaximized ||
         aAppearance == StyleAppearance::MozWindowButtonClose ||
         aAppearance == StyleAppearance::MozWindowButtonMinimize ||
         aAppearance == StyleAppearance::MozWindowButtonMaximize ||
-        aAppearance == StyleAppearance::MozWindowButtonRestore) {
-      aState->backdrop = !nsWindow::GetTopLevelWindowActiveState(aFrame);
-    }
-
-    if (aAppearance == StyleAppearance::ScrollbarbuttonUp ||
+        aAppearance == StyleAppearance::MozWindowButtonRestore ||
+        aAppearance == StyleAppearance::ScrollbarbuttonUp ||
         aAppearance == StyleAppearance::ScrollbarbuttonDown ||
         aAppearance == StyleAppearance::ScrollbarbuttonLeft ||
         aAppearance == StyleAppearance::ScrollbarbuttonRight ||
         aAppearance == StyleAppearance::ScrollbarVertical ||
         aAppearance == StyleAppearance::ScrollbarHorizontal ||
         aAppearance == StyleAppearance::ScrollbartrackHorizontal ||
         aAppearance == StyleAppearance::ScrollbartrackVertical ||
         aAppearance == StyleAppearance::ScrollbarthumbVertical||
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -7447,50 +7447,8 @@ nsIWidget::CreateTopLevelWindow()
 }
 
 already_AddRefed<nsIWidget>
 nsIWidget::CreateChildWindow()
 {
   nsCOMPtr<nsIWidget> window = new nsWindow();
   return window.forget();
 }
-
-bool
-nsWindow::GetTopLevelWindowActiveState(nsIFrame *aFrame)
-{
-  // Used by window frame and button box rendering. We can end up in here in
-  // the content process when rendering one of these moz styles freely in a
-  // page. Fail in this case, there is no applicable window focus state.
-  if (!XRE_IsParentProcess()) {
-    return false;
-  }
-  // All headless windows are considered active so they are painted.
-  if (gfxPlatform::IsHeadless()) {
-    return true;
-  }
-  // Get the widget. nsIFrame's GetNearestWidget walks up the view chain
-  // until it finds a real window.
-  nsWindow* window = static_cast<nsWindow*>(aFrame->GetNearestWidget());
-  if (!window) {
-    return false;
-  }
-
-  // Get our toplevel nsWindow.
-  if (!window->mIsTopLevel) {
-      GtkWidget *widget = window->GetMozContainerWidget();
-      if (!widget) {
-        return false;
-      }
-
-      GtkWidget *toplevelWidget = gtk_widget_get_toplevel(widget);
-      window = get_window_for_gtk_widget(toplevelWidget);
-      if (!window) {
-        return false;
-      }
-  }
-
-  GtkWidget* widget = window->GetGtkWidget();
-  if (widget) {
-      return !(gtk_widget_get_state_flags(widget) & GTK_STATE_FLAG_BACKDROP);
-  }
-
-  return false;
-}
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -423,17 +423,16 @@ public:
     } CSDSupportLevel;
     /**
      * Get the support of Client Side Decoration by checking
      * the XDG_CURRENT_DESKTOP environment variable.
      */
     static CSDSupportLevel GetSystemCSDSupportLevel();
 
     static bool TopLevelWindowUseARGBVisual();
-    static bool GetTopLevelWindowActiveState(nsIFrame *aFrame);
 
 protected:
     virtual ~nsWindow();
 
     // event handling code
     void DispatchActivateEvent(void);
     void DispatchDeactivateEvent(void);
     void DispatchResized();