[gtk+/wip/css: 77/167] shorthand: Initialize unparsed values



commit 52bbaf6fa4667a7f3c46a2287194607849af7be0
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 2 04:11:20 2012 +0100

    shorthand: Initialize unparsed values
    
    All values that the parse funcs didn't parse are initialized to
    'initial'.

 gtk/gtkcssshorthandproperty.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssshorthandproperty.c b/gtk/gtkcssshorthandproperty.c
index 79fb1d2..5d86e54 100644
--- a/gtk/gtkcssshorthandproperty.c
+++ b/gtk/gtkcssshorthandproperty.c
@@ -141,6 +141,18 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
       return FALSE;
     }
 
+  /* All values that aren't set by the parse func are set to their
+   * default values here.
+   * XXX: Is the default always initial or can it be inherit? */
+  for (i = 0; i < shorthand->subproperties->len; i++)
+    {
+      GValue *val = g_value_array_get_nth (array, i);
+      if (G_IS_VALUE (val))
+        continue;
+      g_value_init (val, GTK_TYPE_CSS_SPECIAL_VALUE);
+      g_value_set_enum (val, GTK_CSS_INITIAL);
+    }
+
   g_value_unset (value);
   g_value_init (value, G_TYPE_VALUE_ARRAY);
   g_value_set_boxed (value, array);



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