cssnode: Fix a corner case in style computation

When we recomputed the change flags, and the style
did not change, we still need to replace the style
object, since it holds the new change flags.
This commit is contained in:
Matthias Clasen 2020-01-17 22:00:21 -05:00
parent cc3cf581ab
commit 1e7705c08e

View File

@ -930,12 +930,17 @@ gtk_css_node_set_style (GtkCssNode *cssnode,
{ {
g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change); g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
} }
else if (cssnode->style != style && else if (GTK_IS_CSS_ANIMATED_STYLE (cssnode->style) || GTK_IS_CSS_ANIMATED_STYLE (style))
(GTK_IS_CSS_ANIMATED_STYLE (cssnode->style) || GTK_IS_CSS_ANIMATED_STYLE (style)))
{ {
/* This is when animations are starting/stopping but they didn't change any CSS this frame */ /* This is when animations are starting/stopping but they didn't change any CSS this frame */
g_set_object (&cssnode->style, style); g_set_object (&cssnode->style, style);
} }
else if (gtk_css_static_style_get_change (gtk_css_style_get_static_style (cssnode->style)) !=
gtk_css_static_style_get_change (gtk_css_style_get_static_style (style)))
{
/* This is when we recomputed the change flags but the style didn't change */
g_set_object (&cssnode->style, style);
}
gtk_css_style_change_finish (&change); gtk_css_style_change_finish (&change);