Bug 1206516 - Use temporary widget to construct style context for GtkInfoBar. r=karlt
authorAndrew Comminos <acomminos@mozilla.com>
Tue, 29 Sep 2015 19:32:00 +0200
changeset 265564 60d1c59f129f4d08e7e0bdbff271eee88676f9c5
parent 265563 0f9b612eebb193830aba1fb1994e516b05553a17
child 265565 bb9b286f553bb07a176642268091b5504eb1ab7d
push id15472
push usercbook@mozilla.com
push dateFri, 02 Oct 2015 11:51:34 +0000
treeherderfx-team@2c33ef6b27e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1206516
milestone44.0a1
Bug 1206516 - Use temporary widget to construct style context for GtkInfoBar. r=karlt
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)) {