Revert "Fix up GtkLabel and GtkImage sizing"

This reverts commit 3b30cfa344.
This commit is contained in:
Matthias Clasen 2014-05-27 13:04:43 -04:00
parent 7c83a71239
commit 6ce2a8fb13
2 changed files with 10 additions and 35 deletions

View File

@ -1513,25 +1513,6 @@ get_animation_frame (GtkImage *image)
return g_object_ref (gdk_pixbuf_animation_iter_get_pixbuf (priv->animation_iter));
}
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,
@ -1541,9 +1522,11 @@ 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));
gtk_image_get_padding_and_border (image, &border);
state = gtk_widget_get_state_flags (GTK_WIDGET (image));
gtk_style_context_get_border (context, state, &border);
_gtk_icon_helper_get_size (priv->icon_helper, context, &width, &height);
width += border.left + border.right;

View File

@ -3220,22 +3220,14 @@ gtk_label_get_measuring_layout (GtkLabel * label,
}
static void
gtk_label_get_padding_and_border (GtkLabel *label,
GtkBorder *border)
gtk_label_get_border (GtkLabel *label, GtkBorder *border)
{
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder tmp;
context = gtk_widget_get_style_context (GTK_WIDGET (label));
state = gtk_widget_get_state_flags (GTK_WIDGET (label));
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;
gtk_style_context_get_border (context, state, border);
}
static void
@ -3252,7 +3244,7 @@ gtk_label_update_layout_width (GtkLabel *label)
PangoRectangle logical;
gint width, height;
gtk_label_get_padding_and_border (label, &border);
gtk_label_get_border (label, &border);
width = gtk_widget_get_allocated_width (GTK_WIDGET (label)) - border.left - border.right;
height = gtk_widget_get_allocated_height (GTK_WIDGET (label)) - border.top - border.bottom;
@ -3669,7 +3661,7 @@ gtk_label_get_preferred_size (GtkWidget *widget,
smallest_rect.width = PANGO_PIXELS_CEIL (smallest_rect.width);
smallest_rect.height = PANGO_PIXELS_CEIL (smallest_rect.height);
gtk_label_get_padding_and_border (label, &border);
gtk_label_get_border (label, &border);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
@ -3773,7 +3765,7 @@ gtk_label_get_preferred_width_for_height (GtkWidget *widget,
{
GtkBorder border;
gtk_label_get_padding_and_border (label, &border);
gtk_label_get_border (label, &border);
if (priv->wrap)
gtk_label_clear_layout (label);
@ -3808,7 +3800,7 @@ gtk_label_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
{
GtkBorder border;
gtk_label_get_padding_and_border (label, &border);
gtk_label_get_border (label, &border);
if (priv->wrap)
gtk_label_clear_layout (label);
@ -4006,7 +3998,7 @@ get_layout_location (GtkLabel *label,
widget = GTK_WIDGET (label);
priv = label->priv;
gtk_label_get_padding_and_border (label, &border);
gtk_label_get_border (label, &border);
xalign = halign_to_float (widget);
yalign = valign_to_float (widget);