void gtk_css_node_validate_internal (GtkCssNode *cssnode, gint64 timestamp) { GtkCssNode *child; if (!cssnode->invalid) return; gtk_css_node_ensure_style (cssnode, timestamp); /* need to set to FALSE then to TRUE here to make it chain up */ gtk_css_node_set_invalid (cssnode, FALSE); if (!gtk_css_style_is_static (cssnode->style)) gtk_css_node_set_invalid (cssnode, TRUE); GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode); for (child = gtk_css_node_get_first_child (cssnode); child; child = gtk_css_node_get_next_sibling (child)) { if (child->visible) gtk_css_node_validate_internal (child, timestamp); } }
static GtkCssStyle * gtk_css_node_real_update_style (GtkCssNode *cssnode, GtkCssChange change, gint64 timestamp, GtkCssStyle *style) { GtkCssStyle *static_style, *new_static_style, *new_style; if (GTK_IS_CSS_ANIMATED_STYLE (style)) { static_style = GTK_CSS_ANIMATED_STYLE (style)->style; } else { static_style = style; } if (gtk_css_style_needs_recreation (static_style, change)) new_static_style = gtk_css_node_create_style (cssnode); else new_static_style = g_object_ref (static_style); if (new_static_style != static_style || (change & GTK_CSS_CHANGE_ANIMATIONS)) { GtkCssNode *parent = gtk_css_node_get_parent (cssnode); new_style = gtk_css_animated_style_new (new_static_style, parent ? gtk_css_node_get_style (parent) : NULL, timestamp, gtk_css_node_get_style_provider (cssnode), should_create_transitions (change) ? style : NULL); } else if (static_style != style && (change & GTK_CSS_CHANGE_TIMESTAMP)) { new_style = gtk_css_animated_style_new_advance (GTK_CSS_ANIMATED_STYLE (style), static_style, timestamp); } else { new_style = g_object_ref (style); } if (!gtk_css_style_is_static (new_style)) gtk_css_node_set_invalid (cssnode, TRUE); g_object_unref (new_static_style); return new_style; }
static void gtk_css_node_invalidate_timestamp (GtkCssNode *cssnode) { GtkCssNode *child; if (!cssnode->invalid) return; if (!gtk_css_style_is_static (cssnode->style)) gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP); for (child = cssnode->first_child; child; child = child->next_sibling) { gtk_css_node_invalidate_timestamp (child); } }
void gtk_css_node_validate_internal (GtkCssNode *cssnode, gint64 timestamp) { GtkCssNode *child; /* If you run your application with * GTK_DEBUG=no-css-cache * every invalidation will purge the cache and completely query * everything anew form the cache. This is slow (in particular * when animating), but useful for figuring out bugs. * * We achieve that by pretending that everything that could have * changed has and so we of course totally need to redo everything. * * Note that this also completely revalidates child widgets all * the time. */ #ifdef G_ENABLE_DEBUG if (GTK_DEBUG_CHECK (NO_CSS_CACHE)) cssnode->pending_changes |= GTK_CSS_CHANGE_ANY; #endif if (!cssnode->invalid) return; gtk_css_node_ensure_style (cssnode, timestamp); /* need to set to FALSE then to TRUE here to make it chain up */ gtk_css_node_set_invalid (cssnode, FALSE); if (!gtk_css_style_is_static (cssnode->style)) gtk_css_node_set_invalid (cssnode, TRUE); GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode); for (child = gtk_css_node_get_first_child (cssnode); child; child = gtk_css_node_get_next_sibling (child)) { if (child->visible) gtk_css_node_validate_internal (child, timestamp); } }