forked from AuroraMiddleware/gtk
widget: Don't forget margins when adjusting
This could lead to the wrong values being passed and computing invalid sizes which would then lead to very unhappy code. Test included.
This commit is contained in:
parent
163616cc0a
commit
7459d430eb
@ -3846,7 +3846,7 @@ gtk_widget_adjust_size_allocation (GtkWidget *widget,
|
||||
&allocation->x,
|
||||
&allocation->width);
|
||||
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL,
|
||||
allocation->width,
|
||||
allocation->width + priv->margin.left + priv->margin.right,
|
||||
&min_height, &natural_height, NULL, NULL);
|
||||
adjust_for_align (priv->valign,
|
||||
natural_height - priv->margin.top - priv->margin.bottom,
|
||||
@ -3867,7 +3867,7 @@ gtk_widget_adjust_size_allocation (GtkWidget *widget,
|
||||
&allocation->y,
|
||||
&allocation->height);
|
||||
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL,
|
||||
allocation->height,
|
||||
allocation->height + priv->margin.top + priv->margin.bottom,
|
||||
&min_width, &natural_width, NULL, NULL);
|
||||
adjust_for_align (effective_align (priv->halign, _gtk_widget_get_direction (widget)),
|
||||
natural_width - priv->margin.left - priv->margin.right,
|
||||
|
@ -527,6 +527,8 @@ testdata = [
|
||||
# it is not in xfail since it succeeds on some platforms
|
||||
#'window-show-contents-on-map.ref.ui',
|
||||
#'window-show-contents-on-map.ui',
|
||||
'wrap-margin-align-critical.ref.ui',
|
||||
'wrap-margin-align-critical.ui',
|
||||
]
|
||||
|
||||
# These need to be fixed but the issue hasn't been tracked down.
|
||||
|
20
testsuite/reftests/wrap-margin-align-critical.ref.ui
Normal file
20
testsuite/reftests/wrap-margin-align-critical.ref.ui
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk40">
|
||||
<object class="GtkWindow">
|
||||
<property name="default-width">300</property>
|
||||
<property name="default-height">300</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">center</property>
|
||||
<property name="label">Hello World</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
21
testsuite/reftests/wrap-margin-align-critical.ui
Normal file
21
testsuite/reftests/wrap-margin-align-critical.ui
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk40">
|
||||
<object class="GtkWindow">
|
||||
<property name="default-width">300</property>
|
||||
<property name="default-height">300</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-start">50</property>
|
||||
<property name="margin-end">50</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hello World</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue
Block a user