+ width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
+ height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
+
+ if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
+ {
+ gtk_widget_get_preferred_width (child, NULL, &child_nat_width);
+
+ child_width = MIN (width, child_nat_width);
+
+ gtk_widget_get_preferred_height_for_width (child, child_width, NULL, &child_nat_height);
+
+ child_height = MIN (height, child_nat_height);
+ }
+ else
+ {
+ gtk_widget_get_preferred_height (child, NULL, &child_nat_height);
+
+ child_height = MIN (height, child_nat_height);
+
+ gtk_widget_get_preferred_width_for_height (child, child_height, NULL, &child_nat_width);
+
+ child_width = MIN (width, child_nat_width);
+ }
+
+ if (width > child_width)
+ child_allocation.width = (child_width *
+ (1.0 - priv->xscale) +
+ width * priv->xscale);
+ else
+ child_allocation.width = width;
+
+ if (height > child_height)
+ child_allocation.height = (child_height *
+ (1.0 - priv->yscale) +
+ height * priv->yscale);
+ else
+ child_allocation.height = height;
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ child_allocation.x = (1.0 - priv->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
+ else
+ child_allocation.x = priv->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
+
+ child_allocation.y = priv->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
+
+ gtk_widget_size_allocate (child, &child_allocation);