cssnode: Add gtk_css_node_invalidate_style_provider()

This function not just invalidates the current node, but also all
children.
This commit is contained in:
Benjamin Otte 2015-02-17 16:11:38 +01:00
parent 16b8972bee
commit cadf6a9d3c
3 changed files with 22 additions and 1 deletions

View File

@ -438,6 +438,9 @@ gtk_css_node_reposition (GtkCssNode *node,
{
gtk_css_node_parent_was_unset (node);
}
if (gtk_css_node_get_style_provider_or_null (node) == NULL)
gtk_css_node_invalidate_style_provider (node);
}
if (parent)
@ -736,6 +739,22 @@ gtk_css_node_get_declaration (GtkCssNode *cssnode)
return cssnode->decl;
}
void
gtk_css_node_invalidate_style_provider (GtkCssNode *cssnode)
{
GtkCssNode *child;
gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_SOURCE);
for (child = cssnode->first_child;
child;
child = child->next_sibling)
{
if (gtk_css_node_get_style_provider_or_null (child) == NULL)
gtk_css_node_invalidate_style_provider (child);
}
}
void
gtk_css_node_invalidate (GtkCssNode *cssnode,
GtkCssChange change)

View File

@ -139,6 +139,8 @@ void gtk_css_node_set_style (GtkCssNode *
GtkCssStyle *style);
GtkCssStyle * gtk_css_node_create_style (GtkCssNode *cssnode);
void gtk_css_node_invalidate_style_provider
(GtkCssNode *cssnode);
void gtk_css_node_invalidate (GtkCssNode *cssnode,
GtkCssChange change);
void gtk_css_node_validate (GtkCssNode *cssnode,

View File

@ -289,7 +289,7 @@ static void
gtk_style_context_cascade_changed (GtkStyleCascade *cascade,
GtkStyleContext *context)
{
gtk_css_node_invalidate (gtk_style_context_get_root (context), GTK_CSS_CHANGE_SOURCE);
gtk_css_node_invalidate_style_provider (gtk_style_context_get_root (context));
}
static void