viewport: Don't subtract borders and padding from -1

-1 is a special value for "undefined" and needs to stay that way

https://bugzilla.gnome.org/show_bug.cgi?id=729607
This commit is contained in:
Benjamin Otte 2014-05-06 04:00:38 +02:00
parent c39b6be22b
commit 352e28a138

View File

@ -1049,11 +1049,13 @@ gtk_viewport_get_preferred_size (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL) if (orientation == GTK_ORIENTATION_HORIZONTAL)
{ {
if (for_size >= 0)
for_size -= border.top + border.bottom; for_size -= border.top + border.bottom;
minimum += border.left + border.right; minimum += border.left + border.right;
} }
else else
{ {
if (for_size >= 0)
for_size -= border.left + border.right; for_size -= border.left + border.right;
minimum += border.top + border.bottom; minimum += border.top + border.bottom;
} }
@ -1061,11 +1063,13 @@ gtk_viewport_get_preferred_size (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL) if (orientation == GTK_ORIENTATION_HORIZONTAL)
{ {
if (for_size >= 0)
for_size -= padding.top + padding.bottom; for_size -= padding.top + padding.bottom;
minimum += padding.left + padding.right; minimum += padding.left + padding.right;
} }
else else
{ {
if (for_size >= 0)
for_size -= padding.left + padding.right; for_size -= padding.left + padding.right;
minimum += padding.top + padding.bottom; minimum += padding.top + padding.bottom;
} }