Bug 1206516 - Use temporary widget to construct style context for GtkInfoBar. r=karlt, a=lizzard
authorAndrew Comminos <acomminos@mozilla.com>
Tue, 29 Sep 2015 19:32:00 +0200
changeset 296565 21faa7b5534a36eee66c1074b6c3dcb9667457be
parent 296564 d7170bf8704fc5ccac487b52963f3a801f5663f8
child 296566 f12d6489dda48fd709366e71dc7052fd1ed2fa66
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, lizzard
bugs1206516
milestone43.0a2
Bug 1206516 - Use temporary widget to construct style context for GtkInfoBar. r=karlt, a=lizzard
widget/gtk/mozgtk/mozgtk.c
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -252,16 +252,17 @@ STUB(gtk_im_context_get_preedit_string)
 STUB(gtk_im_context_reset)
 STUB(gtk_im_context_set_client_window)
 STUB(gtk_im_context_set_cursor_location)
 STUB(gtk_im_context_set_surrounding)
 STUB(gtk_im_context_simple_new)
 STUB(gtk_im_multicontext_get_type)
 STUB(gtk_im_multicontext_new)
 STUB(gtk_info_bar_get_type)
+STUB(gtk_info_bar_get_content_area)
 STUB(gtk_info_bar_new)
 STUB(gtk_init)
 STUB(gtk_invisible_new)
 STUB(gtk_key_snooper_install)
 STUB(gtk_key_snooper_remove)
 STUB(gtk_label_get_type)
 STUB(gtk_label_new)
 STUB(gtk_label_set_markup)
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -1197,25 +1197,25 @@ nsLookAndFeel::Init()
     // for GTK_BORDER_STYLE_INSET/OUTSET/GROVE/RIDGE border styles (Bug 978172).
     style = gtk_widget_get_style_context(frame);
     gtk_style_context_get_border_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sFrameInnerDarkBorder = sFrameOuterLightBorder = GDK_RGBA_TO_NS_RGBA(color);
 
     gtk_widget_path_free(path);
 
     // GtkInfoBar
-    path = gtk_widget_path_new();
-    gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
-    gtk_widget_path_append_type(path, GTK_TYPE_INFO_BAR);
-    style = create_context(path);
+    GtkWidget* infoBar = gtk_info_bar_new();
+    GtkWidget* infoBarContent = gtk_info_bar_get_content_area(GTK_INFO_BAR(infoBar));
+    GtkWidget* infoBarLabel = gtk_label_new(nullptr);
+    gtk_container_add(GTK_CONTAINER(parent), infoBar);
+    gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
+    style = gtk_widget_get_style_context(infoBarLabel);
     gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
     gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
     sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
-    g_object_unref(style);
-    gtk_widget_path_free(path);
 #endif
     // Some themes have a unified menu bar, and support window dragging on it
     gboolean supports_menubar_drag = FALSE;
     GParamSpec *param_spec =
         gtk_widget_class_find_style_property(GTK_WIDGET_GET_CLASS(menuBar),
                                              "window-dragging");
     if (param_spec) {
         if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) {