[gtk+/gtk-style-context: 66/490] GtkCssProvider: Allow empty selector.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 66/490] GtkCssProvider: Allow empty selector.
- Date: Wed, 24 Nov 2010 13:45:10 +0000 (UTC)
commit b06e8f7a2dc450ba30edd8730a5e43a80aa358e5
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 16 01:44:50 2010 +0200
GtkCssProvider: Allow empty selector.
universal selector is implied, so things like this work:
:active {}
:insensitive{}
gtk/gtkcssprovider.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index ffb23b8..71d58c7 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -177,6 +177,12 @@ selector_path_prepend_glob (SelectorPath *path)
path->elements = g_slist_prepend (path->elements, elem);
}
+static gint
+selector_path_depth (SelectorPath *path)
+{
+ return g_slist_length (path->elements);
+}
+
static SelectorStyleInfo *
selector_style_info_new (SelectorPath *path)
{
@@ -589,7 +595,8 @@ parse_selector (GtkCssProvider *css_provider,
*selector_out = NULL;
- if (scanner->token != G_TOKEN_IDENTIFIER)
+ if (scanner->token != ':' &&
+ scanner->token != G_TOKEN_IDENTIFIER)
return G_TOKEN_IDENTIFIER;
path = selector_path_new ();
@@ -611,6 +618,10 @@ parse_selector (GtkCssProvider *css_provider,
if (scanner->token == ':')
{
+ /* Add glob selector if path is empty */
+ if (selector_path_depth (path) == 0)
+ selector_path_prepend_glob (path);
+
/* Pseudo-class scanning */
css_provider_push_scope (css_provider, SCOPE_PSEUDO_CLASS);
g_scanner_get_next_token (scanner);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]