table-layout: Fix size request when there are no visible rows/cols

The calculation (n - 1) * spacing to compute the total spacing is
only correct for n >= 1 - if there are no visible rows/cols, the
required spacing is 0 rather than negative.

https://bugzilla.gnome.org/show_bug.cgi?id=709434
This commit is contained in:
Florian Müllner 2013-10-04 21:32:30 +02:00
parent 067fcc3690
commit 44b1a808c8

View File

@ -1291,7 +1291,7 @@ clutter_table_layout_get_preferred_width (ClutterLayoutManager *layout,
calculate_table_dimensions (self, container, -1, for_height); calculate_table_dimensions (self, container, -1, for_height);
columns = (DimensionData *) (void *) priv->columns->data; columns = (DimensionData *) (void *) priv->columns->data;
total_min_width = (priv->visible_cols - 1) * (float) priv->col_spacing; total_min_width = MAX ((priv->visible_cols - 1) * (float) priv->col_spacing, 0);
total_pref_width = total_min_width; total_pref_width = total_min_width;
for (i = 0; i < priv->n_cols; i++) for (i = 0; i < priv->n_cols; i++)
@ -1331,7 +1331,7 @@ clutter_table_layout_get_preferred_height (ClutterLayoutManager *layout,
calculate_table_dimensions (self, container, for_width, -1); calculate_table_dimensions (self, container, for_width, -1);
rows = (DimensionData *) (void *) priv->rows->data; rows = (DimensionData *) (void *) priv->rows->data;
total_min_height = (priv->visible_rows - 1) * (float) priv->row_spacing; total_min_height = MAX ((priv->visible_rows - 1) * (float) priv->row_spacing, 0);
total_pref_height = total_min_height; total_pref_height = total_min_height;
for (i = 0; i < self->priv->n_rows; i++) for (i = 0; i < self->priv->n_rows; i++)