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)
- return gtk_widget_path_new ();
-
- return gtk_widget_path_copy (path_node->path);
+ 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 const 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)
- return gtk_widget_path_new ();
-
- return _gtk_widget_create_path (widget_node->widget);
+ 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;
}
static const GtkWidgetPath *
return priv->cssnode;
}
-static GtkWidgetPath *
-create_query_path (GtkStyleContext *context,
- const GtkCssNodeDeclaration *decl,
- gboolean is_root)
-{
- GtkCssNode *root;
- GtkWidgetPath *path;
- guint length;
-
- root = gtk_style_context_get_root (context);
-
- path = gtk_css_node_create_widget_path (root);
- length = gtk_widget_path_length (path);
- if (!is_root)
- {
-
- if (length > 0)
- gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (root), path, length - 1);
-
- gtk_widget_path_append_type (path, length > 0 ? gtk_widget_path_iter_get_object_type (path, length - 1) : G_TYPE_NONE);
- gtk_css_node_declaration_add_to_widget_path (decl, path, length);
- }
- else
- {
- if (length > 0)
- gtk_css_node_declaration_add_to_widget_path (decl, path, length - 1);
- }
-
- return path;
-}
-
static gboolean
gtk_style_context_has_custom_cascade (GtkStyleContext *context)
{
if (result)
return g_object_ref (result);
- path = create_query_path (context, decl, TRUE);
+ path = gtk_css_node_create_widget_path (cssnode);
if (!_gtk_css_matcher_init (&matcher, path))
{
if (style)
return g_object_ref (style);
- path = create_query_path (context,
- decl,
- cssnode == gtk_style_context_get_root (context));
+ path = gtk_css_node_create_widget_path (cssnode);
if (override_state)
gtk_widget_path_iter_set_state (path, -1, state);
cssnode = gtk_css_transient_node_new (priv->cssnode);
gtk_css_node_set_parent (cssnode, gtk_style_context_get_root (context));
+ gtk_css_node_set_widget_type (cssnode, gtk_css_node_get_widget_type (priv->cssnode));
priv->saved_nodes = g_slist_prepend (priv->saved_nodes, priv->cssnode);
priv->cssnode = cssnode;