[gtk/matthiasc/css-matching-4: 3/4] css: Add a root to the selector tree



commit 5a59f068dcafcee380e23b675f42c370628e2382
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 19 23:29:47 2020 -0500

    css: Add a root to the selector tree
    
    Add a virtual root to the selector tree, and give
    it an ANY selector in order to not affect matches.
    
    This will make some of the following changes easier.

 gtk/gtkcssselector.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index aabffb3e3e..9213298096 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -2249,9 +2249,18 @@ _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder)
   guint len;
   GList *l;
   GtkCssSelectorRuleSetInfo *info;
+  gint32 tree_offset;
+  gint32 offset;
 
   array = g_byte_array_new ();
-  subdivide_infos (array, builder->infos, GTK_CSS_SELECTOR_TREE_EMPTY_OFFSET);
+
+  tree = alloc_tree (array, &tree_offset);
+  tree->parent_offset = GTK_CSS_SELECTOR_TREE_EMPTY_OFFSET;
+  tree->sibling_offset = GTK_CSS_SELECTOR_TREE_EMPTY_OFFSET;
+  tree->matches_offset = GTK_CSS_SELECTOR_TREE_EMPTY_OFFSET;
+  tree->selector.class = &GTK_CSS_SELECTOR_ANY;
+  offset = subdivide_infos (array, builder->infos, tree_offset);
+  get_tree (array, tree_offset)->previous_offset = offset;
 
   len = array->len;
   data = g_byte_array_free (array, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]