mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
popover: Take shadow size into account in measure
Commit b9487997
introduced shadows for GtkPopover. These are correctly
subtracted while allocating the child widget, but the child is not
measured with those shadows subtracted (as is correctly done for the
arrow). This can give criticals, for example with some wrapping labels.
To fix this, we subtract the shadow size from the `for_size` before
passing it to the measure() of the child widget.
Closes #5782
Fixes #6796
This commit is contained in:
parent
a35f9102f2
commit
93c5fb0b31
@ -1511,12 +1511,20 @@ gtk_popover_measure (GtkWidget *widget,
|
||||
GtkCssStyle *style;
|
||||
GtkBorder shadow_width;
|
||||
|
||||
if (for_size >= 0 && (POS_IS_VERTICAL (priv->position) == (orientation == GTK_ORIENTATION_HORIZONTAL)))
|
||||
for_size -= tail_height;
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (priv->contents_widget)));
|
||||
gtk_css_shadow_value_get_extents (style->used->box_shadow, &shadow_width);
|
||||
|
||||
if (for_size >= 0)
|
||||
{
|
||||
if ((POS_IS_VERTICAL (priv->position) == (orientation == GTK_ORIENTATION_HORIZONTAL)))
|
||||
for_size -= tail_height;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
for_size -= shadow_width.top + shadow_width.bottom;
|
||||
else
|
||||
for_size -= shadow_width.left + shadow_width.right;
|
||||
}
|
||||
|
||||
gtk_widget_measure (priv->contents_widget,
|
||||
orientation, for_size,
|
||||
minimum, natural,
|
||||
|
Loading…
Reference in New Issue
Block a user