Bug 1408360 - Draw window decoration as a part of the GtkHeaderBar widget, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Thu, 06 Sep 2018 11:52:33 +0000
changeset 435077 76b493351fd75d0d5541f051814326ed7e1b3d04
parent 435076 6615b44439f9ae068611efca66cb09bb94cd3920
child 435078 7b006f2910ccabc207dd3a6c6e861406b5d18fb7
push id34591
push userbtara@mozilla.com
push dateThu, 06 Sep 2018 21:53:32 +0000
treeherdermozilla-central@e9d83a2e788a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1408360
milestone64.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 1408360 - Draw window decoration as a part of the GtkHeaderBar widget, r=jhorak GtkWindow decoration is a part of GtkHeaderBar widget so we need to include that in our GtkHeaderBar paint. Depends on D4663 Differential Revision: https://phabricator.services.mozilla.com/D4664
widget/gtk/gtk3drawing.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2326,16 +2326,33 @@ moz_gtk_header_bar_paint(WidgetNodeType 
     GtkStyleContext *style = GetStyleContext(widgetType, GTK_TEXT_DIR_LTR,
                                              state_flags);
     InsetByMargin(rect, style);
 
     // Some themes (Adwaita for instance) draws bold dark line at
     // titlebar bottom. It does not fit well with Firefox tabs so
     // draw with some extent to make the titlebar bottom part invisible.
     #define TITLEBAR_EXTENT 4
+
+    if (widgetType == MOZ_GTK_HEADER_BAR) {
+        GtkStyleContext* windowStyle = GetStyleContext(MOZ_GTK_WINDOW);
+        bool solidDecorations =
+            gtk_style_context_has_class(windowStyle, "solid-csd");
+        GtkStyleContext *decorationStyle =
+            GetStyleContext(solidDecorations ? MOZ_GTK_WINDOW_DECORATION_SOLID:
+                                               MOZ_GTK_WINDOW_DECORATION,
+                            GTK_TEXT_DIR_LTR,
+                            state_flags);
+
+        gtk_render_background(decorationStyle, cr, rect->x, rect->y,
+                              rect->width, rect->height + TITLEBAR_EXTENT);
+        gtk_render_frame(decorationStyle, cr, rect->x, rect->y,
+                         rect->width, rect->height + TITLEBAR_EXTENT);
+    }
+
     gtk_render_background(style, cr, rect->x, rect->y,
                           rect->width, rect->height + TITLEBAR_EXTENT);
     gtk_render_frame(style, cr, rect->x, rect->y,
                      rect->width, rect->height + TITLEBAR_EXTENT);
 
     return MOZ_GTK_SUCCESS;
 }