bug 1346961 use GtkStateFlags from style context for widget borders r?jhorak draft
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 16 Mar 2017 17:23:03 +1300
changeset 645153 2f56b8f07012cae840d31d7fb9a05c7a7005b608
parent 645152 620ae8e576261f50ad052f7330cdc68c4e48a310
child 645154 05bfb333031b84330e900406a251e17850b7094f
push id73684
push userktomlinson@mozilla.com
push dateFri, 11 Aug 2017 22:29:12 +0000
reviewersjhorak
bugs1346961
milestone57.0a1
bug 1346961 use GtkStateFlags from style context for widget borders r?jhorak so that direction is not cleared and style context is not invalidated unnecessarily. With Ambiance 16.10, the position of the margin depends on direction. Without a direction, the margin is ignored altogether. This is a partial fix to provide consistent sizes. The direction should be provided when determining the border, but that is not addressed here. MozReview-Commit-ID: 4zVu62faUMk
widget/gtk/gtk3drawing.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2008,45 +2008,48 @@ moz_gtk_info_bar_paint(cairo_t *cr, GdkR
 }
 
 static void
 moz_gtk_add_style_margin(GtkStyleContext* style,
                          gint* left, gint* top, gint* right, gint* bottom)
 {
     GtkBorder margin;
 
-    gtk_style_context_get_margin(style, GTK_STATE_FLAG_NORMAL, &margin);
+    gtk_style_context_get_margin(style, gtk_style_context_get_state(style),
+                                 &margin);
 
     *left += margin.left;
     *right += margin.right;
     *top += margin.top;
     *bottom += margin.bottom;
 }
 
 static void
 moz_gtk_add_style_border(GtkStyleContext* style,
                          gint* left, gint* top, gint* right, gint* bottom)
 {
     GtkBorder border;
 
-    gtk_style_context_get_border(style, GTK_STATE_FLAG_NORMAL, &border);
+    gtk_style_context_get_border(style, gtk_style_context_get_state(style),
+                                 &border);
 
     *left += border.left;
     *right += border.right;
     *top += border.top;
     *bottom += border.bottom;
 }
 
 static void
 moz_gtk_add_style_padding(GtkStyleContext* style,
                           gint* left, gint* top, gint* right, gint* bottom)
 {
     GtkBorder padding;
 
-    gtk_style_context_get_padding(style, GTK_STATE_FLAG_NORMAL, &padding);
+    gtk_style_context_get_padding(style, gtk_style_context_get_state(style),
+                                  &padding);
 
     *left += padding.left;
     *right += padding.right;
     *top += padding.top;
     *bottom += padding.bottom;
 }
 
 static void moz_gtk_add_margin_border_padding(GtkStyleContext *style,