[gtk+/wip/css: 29/135] styleproperty: Add custom 'none' handling



commit dadcfe32ffdf7b3aed3a68ce84e3bfed605f2987
Author: Benjamin Otte <otte redhat com>
Date:   Fri Dec 30 12:44:16 2011 +0100

    styleproperty: Add custom 'none' handling
    
    The generic 'none' handling needs to go, because 'none' is not a valid
    value most of the time.

 gtk/gtkstyleproperty.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index 81f1cfd..464875b 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -557,6 +557,12 @@ theming_engine_value_parse (GtkCssParser *parser,
   GtkThemingEngine *engine;
   char *str;
 
+  if (_gtk_css_parser_try (parser, "none", TRUE))
+    {
+      g_value_set_object (value, gtk_theming_engine_load (NULL));
+      return TRUE;
+    }
+
   str = _gtk_css_parser_try_ident (parser, TRUE);
   if (str == NULL)
     {
@@ -565,6 +571,7 @@ theming_engine_value_parse (GtkCssParser *parser,
     }
 
   engine = gtk_theming_engine_load (str);
+
   if (engine == NULL)
     {
       _gtk_css_parser_error (parser, "Themeing engine '%s' not found", str);
@@ -976,7 +983,11 @@ pattern_value_parse (GtkCssParser *parser,
                      GFile        *base,
                      GValue       *value)
 {
-  if (_gtk_css_parser_begins_with (parser, '-'))
+  if (_gtk_css_parser_try (parser, "none", TRUE))
+    {
+      /* nothing to do here */
+    }
+  else if (_gtk_css_parser_begins_with (parser, '-'))
     {
       int res;
       res = _gtk_win32_theme_part_parse (parser, base, value);
@@ -1115,6 +1126,9 @@ shadow_value_parse (GtkCssParser *parser,
 
   shadow = _gtk_shadow_new ();
 
+  if (_gtk_css_parser_try (parser, "none", TRUE))
+    return TRUE;
+
   do
     {
       have_inset = have_lengths = have_color = FALSE;
@@ -1290,6 +1304,9 @@ border_image_value_parse (GtkCssParser *parser,
   gboolean retval = FALSE;
   GtkBorderImage *image = NULL;
 
+  if (_gtk_css_parser_try (parser, "none", TRUE))
+    return TRUE;
+
   g_value_init (&temp, CAIRO_GOBJECT_TYPE_PATTERN);
 
   if (!pattern_value_parse (parser, base, &temp))



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