summaryrefslogtreecommitdiff
path: root/gtk/gtksizerequest.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-05-15 14:38:22 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-07-19 21:27:11 -0400
commitb0c7a876a903820e91408cab76ab0b5876be8e1e (patch)
tree8b865db095af8baa779ff00fb3539a15cfddef05 /gtk/gtksizerequest.c
parent6d34a19cdd1dd108b6f3a112ecc7cb723cd3b16c (diff)
downloadgtk+-b0c7a876a903820e91408cab76ab0b5876be8e1e.tar.gz
sizerequest: Make sure widget sizes stay positive
They can otherwise become negative, e.g. when large negative css margins are applied.
Diffstat (limited to 'gtk/gtksizerequest.c')
-rw-r--r--gtk/gtksizerequest.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 5b54ea3861..2b1b097b4d 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -462,10 +462,10 @@ gtk_widget_measure (GtkWidget *widget,
minimum_baseline, natural_baseline);
if (minimum)
- *minimum = MAX (*minimum, css_min_size) + css_extra_size;
+ *minimum = MAX (0, MAX (*minimum, css_min_size) + css_extra_size);
if (natural)
- *natural = MAX (*natural, css_min_size) + css_extra_size;
+ *natural = MAX (0, MAX (*natural, css_min_size) + css_extra_size);
/* TODO: Baselines! */
return;
@@ -497,8 +497,8 @@ gtk_widget_measure (GtkWidget *widget,
gtk_widget_query_size_for_orientation (tmp_widget, orientation, for_size, &min_dimension, &nat_dimension, NULL, NULL);
- min_result = MAX (min_result, MAX (min_dimension, css_min_size) + css_extra_size);
- nat_result = MAX (nat_result, MAX (nat_dimension, css_min_size) + css_extra_size);
+ min_result = MAX (0, MAX (min_result, MAX (min_dimension, css_min_size) + css_extra_size));
+ nat_result = MAX (0, MAX (nat_result, MAX (nat_dimension, css_min_size) + css_extra_size));
}
g_hash_table_destroy (widgets);