cssnode: Redo style changed tracking
We don't return a NULL style to mean "no changes" anymore, instead we check new_style == old_style to mean that. Make sure the code reflects this, otherwise we'll send GTK_CSS_CHANGE_PARENT_STYLE invalidations everywhere and screw up performance.
This commit is contained in:
@ -588,12 +588,12 @@ gtk_css_node_get_next_sibling (GtkCssNode *cssnode)
|
|||||||
return cssnode->next_sibling;
|
return cssnode->next_sibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gtk_css_node_set_style (GtkCssNode *cssnode,
|
gtk_css_node_set_style (GtkCssNode *cssnode,
|
||||||
GtkCssStyle *style)
|
GtkCssStyle *style)
|
||||||
{
|
{
|
||||||
if (cssnode->style == style)
|
if (cssnode->style == style)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
if (style)
|
if (style)
|
||||||
g_object_ref (style);
|
g_object_ref (style);
|
||||||
@ -602,6 +602,8 @@ gtk_css_node_set_style (GtkCssNode *cssnode,
|
|||||||
g_object_unref (cssnode->style);
|
g_object_unref (cssnode->style);
|
||||||
|
|
||||||
cssnode->style = style;
|
cssnode->style = style;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -645,6 +647,7 @@ gtk_css_node_ensure_style (GtkCssNode *cssnode,
|
|||||||
gint64 current_time)
|
gint64 current_time)
|
||||||
{
|
{
|
||||||
GtkCssStyle *new_style;
|
GtkCssStyle *new_style;
|
||||||
|
gboolean style_changed;
|
||||||
|
|
||||||
if (!gtk_css_node_needs_new_style (cssnode))
|
if (!gtk_css_node_needs_new_style (cssnode))
|
||||||
return;
|
return;
|
||||||
@ -660,15 +663,12 @@ gtk_css_node_ensure_style (GtkCssNode *cssnode,
|
|||||||
current_time,
|
current_time,
|
||||||
cssnode->style);
|
cssnode->style);
|
||||||
|
|
||||||
gtk_css_node_propagate_pending_changes (cssnode, new_style != NULL);
|
style_changed = gtk_css_node_set_style (cssnode, new_style);
|
||||||
|
|
||||||
if (new_style)
|
|
||||||
{
|
|
||||||
gtk_css_node_set_style (cssnode, new_style);
|
|
||||||
g_object_unref (new_style);
|
g_object_unref (new_style);
|
||||||
cssnode->pending_changes = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
gtk_css_node_propagate_pending_changes (cssnode, style_changed);
|
||||||
|
|
||||||
|
cssnode->pending_changes = 0;
|
||||||
cssnode->style_is_invalid = FALSE;
|
cssnode->style_is_invalid = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user