actor: Fix clutter_actor_allocate_align_fill for partially-filled actors

If we pass TRUE for x_align and FALSE for y_align, the full available
width should be passed to clutter_get_preferred_height, and the same
should be true in the other dimension.

https://bugzilla.gnome.org/show_bug.cgi?id=694237
This commit is contained in:
Jasper St. Pierre 2013-02-19 22:15:52 -05:00 committed by Emmanuele Bassi
parent 160c62b2f9
commit 50f6b2ac2c

View File

@ -15205,34 +15205,32 @@ clutter_actor_allocate_align_fill (ClutterActor *self,
if (available_height < 0)
available_height = 0;
allocation.x1 = x_offset;
allocation.y1 = y_offset;
if (x_fill)
{
allocation.x1 = x_offset;
allocation.x2 = allocation.x1 + available_width;
}
child_width = available_width;
if (y_fill)
{
allocation.y1 = y_offset;
allocation.y2 = allocation.y1 + available_height;
}
child_height = available_height;
/* if we are filling horizontally and vertically then we're done */
if (x_fill && y_fill)
goto out;
child_width = child_height = 0.0f;
if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
{
gfloat min_width, natural_width;
gfloat min_height, natural_height;
clutter_actor_get_preferred_width (self, available_height,
&min_width,
&natural_width);
if (!x_fill)
{
clutter_actor_get_preferred_width (self, available_height,
&min_width,
&natural_width);
child_width = CLAMP (natural_width, min_width, available_width);
child_width = CLAMP (natural_width, min_width, available_width);
}
if (!y_fill)
{
@ -15248,11 +15246,14 @@ clutter_actor_allocate_align_fill (ClutterActor *self,
gfloat min_width, natural_width;
gfloat min_height, natural_height;
clutter_actor_get_preferred_height (self, available_width,
&min_height,
&natural_height);
if (!y_fill)
{
clutter_actor_get_preferred_height (self, available_width,
&min_height,
&natural_height);
child_height = CLAMP (natural_height, min_height, available_height);
child_height = CLAMP (natural_height, min_height, available_height);
}
if (!x_fill)
{
@ -15270,23 +15271,18 @@ clutter_actor_allocate_align_fill (ClutterActor *self,
if (!x_fill)
{
allocation.x1 = x_offset
+ ((available_width - child_width) * x_align);
allocation.x1 += ((available_width - child_width) * x_align);
allocation.x2 = allocation.x1 + child_width;
}
if (!y_fill)
{
allocation.y1 = y_offset
+ ((available_height - child_height) * y_align);
allocation.y1 += ((available_height - child_height) * y_align);
allocation.y2 = allocation.y1 + child_height;
}
out:
child_width = allocation.x2 - allocation.x1;
child_height = allocation.y2 - allocation.y1;
allocation.x1 = floorf (allocation.x1);
allocation.y1 = floorf (allocation.y1);
allocation.x2 = ceilf (allocation.x1 + child_width);