Bug 1507423 - Implement StyleAppearance::MozWindowButtonBox on widget/gtk. r=mconley, a=RyanVM
authorMartin Stransky <stransky@redhat.com>
Tue, 18 Dec 2018 19:06:08 +0000
changeset 509141 c251f26c00d2737f3e0231afbf97123884542a46
parent 509140 08d3a2f3dfd435d6ff454791550b0e533ac0c615
child 509142 171e95e6389b91c74fd957787b952cb20699a117
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)
reviewersmconley, RyanVM
bugs1507423
milestone65.0
Bug 1507423 - Implement StyleAppearance::MozWindowButtonBox on widget/gtk. r=mconley, a=RyanVM Depends on D14242 Differential Revision: https://phabricator.services.mozilla.com/D14243
widget/gtk/gtk3drawing.cpp
widget/gtk/gtkdrawing.h
widget/gtk/nsNativeThemeGTK.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2339,16 +2339,27 @@ gint moz_gtk_get_widget_border(WidgetNod
       GtkStyleContext* boxStyle = GetStyleContext(MOZ_GTK_TOOLTIP_BOX);
       moz_gtk_add_margin_border_padding(boxStyle, left, top, right, bottom);
 
       GtkStyleContext* labelStyle = GetStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL);
       moz_gtk_add_margin_border_padding(labelStyle, left, top, right, bottom);
 
       return MOZ_GTK_SUCCESS;
     }
+    case MOZ_GTK_HEADER_BAR_BUTTON_BOX: {
+      style = GetStyleContext(MOZ_GTK_HEADER_BAR);
+      moz_gtk_add_border_padding(style, left, top, right, bottom);
+      *top = *bottom = 0;
+      if (direction == GTK_TEXT_DIR_RTL) {
+        *right = 0;
+      } else {
+        *left = 0;
+      }
+      return MOZ_GTK_SUCCESS;
+    }
     /* These widgets have no borders, since they are not containers. */
     case MOZ_GTK_CHECKBUTTON_LABEL:
     case MOZ_GTK_RADIOBUTTON_LABEL:
     case MOZ_GTK_SPLITTER_HORIZONTAL:
     case MOZ_GTK_SPLITTER_VERTICAL:
     case MOZ_GTK_CHECKBUTTON:
     case MOZ_GTK_RADIOBUTTON:
     case MOZ_GTK_SCROLLBAR_BUTTON:
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -316,16 +316,18 @@ typedef enum {
   /* Paints a GtkComboBox entry arrow widget. */
   MOZ_GTK_COMBOBOX_ENTRY_ARROW,
   /* Used for scrolled window shell. */
   MOZ_GTK_SCROLLED_WINDOW,
   /* Paints a GtkHeaderBar */
   MOZ_GTK_HEADER_BAR,
   /* Paints a GtkHeaderBar in maximized state */
   MOZ_GTK_HEADER_BAR_MAXIMIZED,
+  /* Container for GtkHeaderBar buttons */
+  MOZ_GTK_HEADER_BAR_BUTTON_BOX,
   /* Paints GtkHeaderBar title buttons.
    * Keep the order here as MOZ_GTK_HEADER_BAR_BUTTON_* are processed
    * as an array from MOZ_GTK_HEADER_BAR_BUTTON_CLOSE to the last one.
    */
   MOZ_GTK_HEADER_BAR_BUTTON_CLOSE,
   MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE,
   MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE,
 
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -766,16 +766,19 @@ bool nsNativeThemeGTK::GetGtkWidgetAndSt
       aGtkWidgetType = MOZ_GTK_INFO_BAR;
       break;
     case StyleAppearance::MozWindowTitlebar:
       aGtkWidgetType = MOZ_GTK_HEADER_BAR;
       break;
     case StyleAppearance::MozWindowTitlebarMaximized:
       aGtkWidgetType = MOZ_GTK_HEADER_BAR_MAXIMIZED;
       break;
+    case StyleAppearance::MozWindowButtonBox:
+      aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_BOX;
+      break;
     case StyleAppearance::MozWindowButtonClose:
       aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_CLOSE;
       break;
     case StyleAppearance::MozWindowButtonMinimize:
       aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE;
       break;
     case StyleAppearance::MozWindowButtonMaximize:
       aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE;
@@ -1358,16 +1361,17 @@ bool nsNativeThemeGTK::GetWidgetPadding(
   if (aAppearance == StyleAppearance::MenulistButton &&
       StaticPrefs::layout_css_webkit_appearance_enabled()) {
     aAppearance = StyleAppearance::Menulist;
   }
 
   switch (aAppearance) {
     case StyleAppearance::ButtonFocus:
     case StyleAppearance::Toolbarbutton:
+    case StyleAppearance::MozWindowButtonBox:
     case StyleAppearance::MozWindowButtonClose:
     case StyleAppearance::MozWindowButtonMinimize:
     case StyleAppearance::MozWindowButtonMaximize:
     case StyleAppearance::MozWindowButtonRestore:
     case StyleAppearance::Dualbutton:
     case StyleAppearance::TabScrollArrowBack:
     case StyleAppearance::TabScrollArrowForward:
     case StyleAppearance::MenulistButton:
@@ -1885,16 +1889,17 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
     case StyleAppearance::Splitter:
     case StyleAppearance::Window:
     case StyleAppearance::Dialog:
 #ifdef MOZ_WIDGET_GTK
     case StyleAppearance::MozGtkInfoBar:
 #endif
       return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
 
+    case StyleAppearance::MozWindowButtonBox:
     case StyleAppearance::MozWindowButtonClose:
     case StyleAppearance::MozWindowButtonMinimize:
     case StyleAppearance::MozWindowButtonMaximize:
     case StyleAppearance::MozWindowButtonRestore:
     case StyleAppearance::MozWindowTitlebar:
     case StyleAppearance::MozWindowTitlebarMaximized:
       // GtkHeaderBar is available on GTK 3.10+, which is used for styling
       // title bars and title buttons.