cssnode: Catch case where a style didn't change

Catch the case where a CSS style did not change and don't emit the
style-changed signal in that case.

This saves not only the emission of the signal, but also doesn't cause
invalidation in child nodes, which would previously get a PARENT_STYLE
This commit is contained in:
Benjamin Otte 2015-12-12 02:09:01 +01:00
parent 971a277419
commit 2c61316677

View File

@ -950,17 +950,20 @@ gtk_css_node_set_style (GtkCssNode *cssnode,
GtkCssStyle *style)
{
GtkCssStyleChange change;
gboolean style_changed;
if (cssnode->style == style)
return FALSE;
gtk_css_style_change_init (&change, cssnode->style, style);
g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
style_changed = gtk_css_style_change_has_change (&change);
if (style_changed)
g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
gtk_css_style_change_finish (&change);
return TRUE;
return style_changed;
}
static void