[gtk+/wip/baedert/drawing: 328/371] sizerequest: Add more assertions for baselines



commit bbead9977464d09ecded38b64b0f69bc8e742c58
Author: Timm Bäder <mail baedert org>
Date:   Tue Jul 4 11:35:06 2017 +0200

    sizerequest: Add more assertions for baselines
    
    min baselines must be <= natural baselines and both must lie inside the
    content size of the widget.

 gtk/gtksizerequest.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index e1baaf1..0b1564e 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -305,6 +305,18 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
              min_baseline = -1;
              nat_baseline = -1;
            }
+          else if (min_baseline > reported_min_size ||
+                   nat_baseline > reported_nat_size ||
+                   min_baseline < 0 ||
+                   nat_baseline < 0)
+            {
+              g_warning ("%s %p reported baselines of minimum %d and natural %d, but sizes of "
+                         "minimum %d and natural %d. Baselines must be inside the widget size.",
+                         G_OBJECT_TYPE_NAME (widget), widget, min_baseline, nat_baseline,
+                         reported_min_size, reported_nat_size);
+              min_baseline = -1;
+              nat_baseline = -1;
+            }
          else
             {
               if (css_min_size > reported_min_size)


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