Bug 1073117 - Fixed Theme issues with GTK 3.14 - GtkButtons - use border style
authorMartin Stransky <stransky@redhat.com>
Wed, 25 Mar 2015 11:41:21 -0700
changeset 235668 7b69e3da12119fab74d3ec030e7823c123609952
parent 235667 e54525519ddad6b2241c3a7bcb0293de3e48f144
child 235669 e36d161eef9b37c39cf4d40cdbd7229f78a55ddd
push id57472
push userkwierso@gmail.com
push dateWed, 25 Mar 2015 20:18:23 +0000
treeherdermozilla-inbound@826a214ee46f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1073117
milestone39.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 1073117 - Fixed Theme issues with GTK 3.14 - GtkButtons - use border style property for focus rendering. Don't follow interior-focus which is always true in Gtk 3.14. r=karlt
widget/gtk/gtk3drawing.c
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -865,29 +865,18 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
                      GtkWidgetState* state,
                      GtkReliefStyle relief, GtkWidget* widget,
                      GtkTextDirection direction)
 {
     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
     GtkStyleContext* style = gtk_widget_get_style_context(widget);    
     gint x = rect->x, y=rect->y, width=rect->width, height=rect->height;
 
-    gboolean interior_focus;
-    gint focus_width, focus_pad;
-
-    moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
     gtk_widget_set_direction(widget, direction);
-
-    if (!interior_focus && state->focused) {
-        x += focus_width + focus_pad;
-        y += focus_width + focus_pad;
-        width -= 2 * (focus_width + focus_pad);
-        height -= 2 * (focus_width + focus_pad);
-    }
-  
+ 
     gtk_style_context_save(style);
     gtk_style_context_set_state(style, state_flags);
 
     if (state->isDefault && relief == GTK_RELIEF_NORMAL) {
         /* handle default borders both outside and inside the button */
         gint default_top, default_left, default_bottom, default_right;
         moz_gtk_button_get_default_overflow(&default_top, &default_left,
                                             &default_bottom, &default_right);
@@ -910,30 +899,22 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
         /* the following line can trigger an assertion (Crux theme)
            file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area):
            assertion `GDK_IS_WINDOW (window)' failed */
         gtk_render_background(style, cr, x, y, width, height);
         gtk_render_frame(style, cr, x, y, width, height);
     }
 
     if (state->focused) {
-        if (interior_focus) {
-            GtkBorder border;
-            gtk_style_context_get_border(style, state_flags, &border);
-            x += border.left + focus_pad;
-            y += border.top + focus_pad;
-            width -= 2 * (border.left + focus_pad);
-            height -= 2 * (border.top + focus_pad);
-        } else {
-            x -= focus_width + focus_pad;
-            y -= focus_width + focus_pad;
-            width += 2 * (focus_width + focus_pad);
-            height += 2 * (focus_width + focus_pad);
-        }
-
+        GtkBorder border;
+        gtk_style_context_get_border(style, state_flags, &border);
+        x += border.left;
+        y += border.top;
+        width -= (border.left + border.right);
+        height -= (border.top + border.bottom);
         gtk_render_focus(style, cr, x, y, width, height);
     }
     gtk_style_context_restore(style);
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
 moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,