mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-30 15:31:34 +00:00
stylecontext: Get rid of create_query_path()
Move that functionality into GtkCssNode.
This commit is contained in:
parent
6f99a3cdb0
commit
d79a44c1af
@ -26,11 +26,23 @@ 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)
|
||||
return gtk_widget_path_new ();
|
||||
path = gtk_widget_path_new ();
|
||||
else
|
||||
path = gtk_widget_path_copy (path_node->path);
|
||||
|
||||
return 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 *
|
||||
|
@ -27,11 +27,23 @@ 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)
|
||||
return gtk_widget_path_new ();
|
||||
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 _gtk_widget_create_path (widget_node->widget);
|
||||
return path;
|
||||
}
|
||||
|
||||
static const GtkWidgetPath *
|
||||
|
@ -625,37 +625,6 @@ gtk_style_context_get_root (GtkStyleContext *context)
|
||||
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)
|
||||
{
|
||||
@ -770,7 +739,7 @@ update_properties (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))
|
||||
{
|
||||
@ -811,9 +780,7 @@ build_properties (GtkStyleContext *context,
|
||||
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);
|
||||
|
||||
@ -1634,6 +1601,7 @@ gtk_style_context_save (GtkStyleContext *context)
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user