sizerequest: Keep branches in sync
authorMatthias Clasen <mclasen@redhat.com>
Sat, 24 Jul 2021 22:41:09 +0000 (18:41 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 24 Jul 2021 22:49:41 +0000 (18:49 -0400)
There are some unintentional differences between
the path that uses a layout manager, and the path
that uses widget vfuncs. Sync them up.

gtk/gtksizerequest.c

index 935112061af5953bc712dcc4b2d58676cfa94061..0a1bc48774777792695e394f269949badef42be8 100644 (file)
@@ -272,13 +272,13 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
               gtk_widget_measure (widget, OPPOSITE_ORIENTATION (orientation), -1,
                                   &minimum_for_size, &natural_for_size, NULL, NULL);
 
-              /* TODO: Warn if the given for_size is too small? */
               if (for_size < MAX (minimum_for_size, css_min_for_size))
                 for_size = MAX (minimum_for_size, css_min_for_size);
 
               adjusted_for_size = for_size - widget_margins_for_size;
-
               adjusted_for_size -= css_extra_for_size;
+              if (adjusted_for_size < 0)
+                adjusted_for_size = MAX (minimum_for_size, css_min_for_size);
 
               push_recursion_check (widget, orientation);
               widget_class->measure (widget,