summaryrefslogtreecommitdiff
path: root/gtk/gtkimage.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-05-27 00:21:46 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-05-27 00:22:40 -0400
commit3b30cfa344ebc035ae7318dda5cfa11b8ab3aee7 (patch)
treeabe1f550d3dd33dba04e2727b92ddaf286225a5a /gtk/gtkimage.c
parent2488b954f24c01f99995ff22898628c57b4aedc1 (diff)
downloadgtk+-3b30cfa344ebc035ae7318dda5cfa11b8ab3aee7.tar.gz
Fix up GtkLabel and GtkImage sizing
When GtkMisc was removed, I forgot to apply the style context padding. This caused the info-bar-message-types reftest to fail.
Diffstat (limited to 'gtk/gtkimage.c')
-rw-r--r--gtk/gtkimage.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index f806cc96a7..115920b1f3 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1514,6 +1514,25 @@ get_animation_frame (GtkImage *image)
}
static void
+gtk_image_get_padding_and_border (GtkImage *image,
+ GtkBorder *border)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder tmp;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (image));
+ state = gtk_widget_get_state_flags (GTK_WIDGET (image));
+
+ gtk_style_context_get_padding (context, state, border);
+ gtk_style_context_get_border (context, state, &tmp);
+ border->top += tmp.top;
+ border->right += tmp.right;
+ border->bottom += tmp.bottom;
+ border->left += tmp.left;
+}
+
+static void
gtk_image_get_preferred_size (GtkImage *image,
gint *width_out,
gint *height_out)
@@ -1522,11 +1541,9 @@ gtk_image_get_preferred_size (GtkImage *image,
gint width, height;
GtkBorder border;
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (image));
- state = gtk_widget_get_state_flags (GTK_WIDGET (image));
- gtk_style_context_get_border (context, state, &border);
+ gtk_image_get_padding_and_border (image, &border);
_gtk_icon_helper_get_size (priv->icon_helper, context, &width, &height);
width += border.left + border.right;