[gtk+] cssselector: Add none selector
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssselector: Add none selector
- Date: Tue, 25 Nov 2014 18:34:42 +0000 (UTC)
commit 965da578c47f5acc3ff16b553b4deec1c1b3738f
Author: Benjamin Otte <otte redhat com>
Date: Tue Nov 25 19:31:23 2014 +0100
cssselector: Add none selector
We apparently didn't yet parse :not(*), so write a selector for this.
gtk/gtkcssselector.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 5704aa7..dd4c84e 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -804,6 +804,61 @@ static const GtkCssSelectorClass GTK_CSS_SELECTOR_ANY = {
FALSE, FALSE, FALSE, TRUE, TRUE
};
+/* NONE */
+
+static void
+gtk_css_selector_none_print (const GtkCssSelector *selector,
+ GString *string)
+{
+ g_string_append (string, ":not(*)");
+}
+
+static gboolean
+gtk_css_selector_none_match (const GtkCssSelector *selector,
+ const GtkCssMatcher *matcher)
+{
+ return FALSE;
+}
+
+static void
+gtk_css_selector_none_tree_match (const GtkCssSelectorTree *tree,
+ const GtkCssMatcher *matcher,
+ GHashTable *res)
+{
+}
+
+static GtkCssChange
+gtk_css_selector_none_tree_get_change (const GtkCssSelectorTree *tree,
+ const GtkCssMatcher *matcher)
+{
+ return 0;
+}
+
+
+static GtkCssChange
+gtk_css_selector_none_get_change (const GtkCssSelector *selector, GtkCssChange previous_change)
+{
+ return 0;
+}
+
+static int
+gtk_css_selector_none_compare_one (const GtkCssSelector *a,
+ const GtkCssSelector *b)
+{
+ return 0;
+}
+
+static const GtkCssSelectorClass GTK_CSS_SELECTOR_NONE = {
+ "none",
+ gtk_css_selector_none_print,
+ gtk_css_selector_none_match,
+ gtk_css_selector_none_tree_match,
+ gtk_css_selector_none_get_change,
+ gtk_css_selector_none_tree_get_change,
+ gtk_css_selector_none_compare_one,
+ FALSE, FALSE, FALSE, TRUE, TRUE
+};
+
/* NAME */
typedef struct {
@@ -1838,6 +1893,8 @@ parse_selector_negation (GtkCssParser *parser,
get_type_reference (name));
g_free (name);
}
+ else if (_gtk_css_parser_try (parser, "*", FALSE))
+ selector = gtk_css_selector_new (>K_CSS_SELECTOR_NONE, selector, NULL);
else if (_gtk_css_parser_try (parser, "#", FALSE))
selector = parse_selector_id (parser, selector, TRUE);
else if (_gtk_css_parser_try (parser, ".", FALSE))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]