[gtk+] css: Use the tree to print css selectors
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Use the tree to print css selectors
- Date: Fri, 30 Nov 2012 13:56:59 +0000 (UTC)
commit 3d5e8f98ec4ad3e696bc2d03d29425c6b611613e
Author: Alexander Larsson <alexl redhat com>
Date: Thu Nov 29 16:00:01 2012 +0100
css: Use the tree to print css selectors
gtk/gtkcssprovider.c | 2 +-
gtk/gtkcssselector.c | 12 ++++++++++++
gtk/gtkcssselectorprivate.h | 9 +++++----
3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 358fed2..5500a7c 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -2884,7 +2884,7 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
WidgetPropertyValue *widget_value;
guint i;
- _gtk_css_selector_print (ruleset->selector, str);
+ _gtk_css_selector_tree_match_print (ruleset->selector_match, str);
g_string_append (str, " {\n");
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 2ede3b4..831b089 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1676,6 +1676,18 @@ _gtk_css_selector_tree_print (GtkCssSelectorTree *tree, GString *str, char *pref
#endif
void
+_gtk_css_selector_tree_match_print (const GtkCssSelectorTree *tree,
+ GString *str)
+{
+ g_return_if_fail (tree != NULL);
+
+ tree->selector.class->print (&tree->selector, str);
+
+ if (tree->parent)
+ _gtk_css_selector_tree_match_print (tree->parent, str);
+}
+
+void
_gtk_css_selector_tree_free (GtkCssSelectorTree *tree)
{
if (tree == NULL)
diff --git a/gtk/gtkcssselectorprivate.h b/gtk/gtkcssselectorprivate.h
index 7d811b7..aac2b04 100644
--- a/gtk/gtkcssselectorprivate.h
+++ b/gtk/gtkcssselectorprivate.h
@@ -40,10 +40,11 @@ gboolean _gtk_css_selector_matches (const GtkCssSelector *sel
int _gtk_css_selector_compare (const GtkCssSelector *a,
const GtkCssSelector *b);
-
-void _gtk_css_selector_tree_free (GtkCssSelectorTree *tree);
-GPtrArray *_gtk_css_selector_tree_match_all (GtkCssSelectorTree *tree,
- const GtkCssMatcher *matcher);
+void _gtk_css_selector_tree_free (GtkCssSelectorTree *tree);
+GPtrArray *_gtk_css_selector_tree_match_all (GtkCssSelectorTree *tree,
+ const GtkCssMatcher *matcher);
+void _gtk_css_selector_tree_match_print (const GtkCssSelectorTree *tree,
+ GString *str);
GtkCssSelectorTreeBuilder *_gtk_css_selector_tree_builder_new (void);
void _gtk_css_selector_tree_builder_add (GtkCssSelectorTreeBuilder *builder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]