]> Pileus Git - ~andy/gtk/commitdiff
styleproperty: Simplify compute_value function
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Mar 2012 05:51:20 +0000 (07:51 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:12 +0000 (08:59 +0200)
The compute_value fallback path is only needed for custom properties,
the real style properties have custom compute functions if they need
them already.

gtk/gtkcsscustomproperty.c
gtk/gtkcssstyleproperty.c

index fd53b859b75eb87b3d4ba8790e7e9c920904f601..f58e8d6d206fd4ad287b52dbeb11aa9743e28d09 100644 (file)
@@ -91,10 +91,22 @@ _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
   property_class->parse_value = gtk_css_custom_property_parse_value;
 }
 
+static GtkCssValue *
+gtk_css_custom_property_compute_value (GtkCssStyleProperty *property,
+                                       GtkStyleContext     *context,
+                                       GtkCssValue         *specified)
+{
+  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
+
+  return _gtk_css_style_compute_value (context, custom->pspec->value_type, specified);
+}
 
 static void
-_gtk_css_custom_property_init (GtkCssCustomProperty *custom_property)
+_gtk_css_custom_property_init (GtkCssCustomProperty *custom)
 {
+  GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (custom);
+
+  style->compute_value = gtk_css_custom_property_compute_value;
 }
 
 static GtkCssValue *
index a8bcf2f1ccb3e64b4b7e85d9c8f3877e759d62ed..9a3959d58241e861f7eee2d0487f3436df1a7271 100644 (file)
@@ -303,7 +303,7 @@ gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
                                            GtkStyleContext     *context,
                                            GtkCssValue         *specified)
 {
-  return _gtk_css_style_compute_value (context, _gtk_css_style_property_get_computed_type (property), specified);
+  return _gtk_css_value_ref (specified);
 }
 
 static gboolean