[gtk+/wip/baedert/drawing: 54/396] sizerequest: Make sure widget sizes stay positive



commit 9c879076a6b7e1c3511e3a83851df5eb31464829
Author: Timm Bäder <mail baedert org>
Date:   Mon May 15 14:38:22 2017 +0200

    sizerequest: Make sure widget sizes stay positive
    
    They can otherwise become negative, e.g. when large negative css
    margins are applied.

 gtk/gtksizerequest.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 5b54ea3..2b1b097 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]