static GtkCssStyle * gtk_css_node_create_style (GtkCssNode *cssnode) { const GtkCssNodeDeclaration *decl; GtkCssMatcher matcher; GtkCssStyle *parent; GtkCssStyle *style; decl = gtk_css_node_get_declaration (cssnode); parent = cssnode->parent ? cssnode->parent->style : NULL; style = lookup_in_global_parent_cache (cssnode, decl); if (style) return g_object_ref (style); if (gtk_css_node_init_matcher (cssnode, &matcher)) style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode), &matcher, parent); else style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode), NULL, parent); store_in_global_parent_cache (cssnode, decl, style); return style; }
gboolean gtk_css_path_node_real_init_matcher (GtkCssNode *node, GtkCssMatcher *matcher) { GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node); if (path_node->path == NULL || gtk_widget_path_length (path_node->path) == 0) return FALSE; return _gtk_css_matcher_init (matcher, path_node->path, gtk_css_node_get_declaration (node)); }
gboolean gtk_css_widget_node_init_matcher (GtkCssNode *node, GtkCssMatcher *matcher) { GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node); if (widget_node->widget == NULL) return FALSE; if (!widget_needs_widget_path (widget_node->widget)) return GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->init_matcher (node, matcher); return _gtk_css_matcher_init (matcher, gtk_widget_get_path (widget_node->widget), gtk_css_node_get_declaration (node)); }
static GtkWidgetPath * gtk_css_path_node_real_create_widget_path (GtkCssNode *node) { GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node); GtkWidgetPath *path; guint length; if (path_node->path == NULL) path = gtk_widget_path_new (); else path = gtk_widget_path_copy (path_node->path); length = gtk_widget_path_length (path); if (length > 0) { gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node), path, length - 1); } return path; }
static GtkWidgetPath * gtk_css_widget_node_create_widget_path (GtkCssNode *node) { GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node); GtkWidgetPath *path; guint length; if (widget_node->widget == NULL) path = gtk_widget_path_new (); else path = _gtk_widget_create_path (widget_node->widget); length = gtk_widget_path_length (path); if (length > 0) { gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node), path, length - 1); } return path; }