[gtk+/wip/cssvalue: 57/164] styleproperty: Simplify compute_value function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue: 57/164] styleproperty: Simplify compute_value function
- Date: Wed, 11 Apr 2012 14:44:42 +0000 (UTC)
commit d29ba89ef0ad74b7cc2cb12862e32b7e5ab97f88
Author: Benjamin Otte <otte redhat com>
Date: Tue Mar 27 07:51:20 2012 +0200
styleproperty: Simplify compute_value function
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 | 14 +++++++++++++-
gtk/gtkcssstyleproperty.c | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcsscustomproperty.c b/gtk/gtkcsscustomproperty.c
index fd53b85..f58e8d6 100644
--- a/gtk/gtkcsscustomproperty.c
+++ b/gtk/gtkcsscustomproperty.c
@@ -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 *
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index a8bcf2f..9a3959d 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]