[gtk+/wip/css: 6/36] css: Initialize value before calling compute function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 6/36] css: Initialize value before calling compute function
- Date: Wed, 18 Jan 2012 09:39:01 +0000 (UTC)
commit c657002d0a91f7065abf98bd50643a83261e7945
Author: Benjamin Otte <otte redhat com>
Date: Sat Jan 14 05:00:54 2012 +0100
css: Initialize value before calling compute function
gtk/gtkcssstyleproperty.c | 3 ++-
gtk/gtkcssstylepropertyimpl.c | 13 ++++---------
2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 9743b88..348ea0d 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -287,7 +287,6 @@ gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
const GValue *specified)
{
- g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
_gtk_css_style_compute_value (computed, context, specified);
}
@@ -465,6 +464,8 @@ _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (G_IS_VALUE (specified));
+ g_value_init (computed, _gtk_css_style_property_get_computed_type (property));
+
property->compute_value (property, computed, context, specified);
}
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 6bfd681..9112be0 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -52,11 +52,6 @@ color_compute (GtkCssStyleProperty *property,
GtkStyleContext *context,
const GValue *specified)
{
- g_value_init (computed, GDK_TYPE_RGBA);
-
- /* for when resolvage fails */
-restart:
-
if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR))
{
GtkSymbolicColor *symbolic = g_value_get_boxed (specified);
@@ -92,8 +87,10 @@ restart:
}
else
{
- specified = _gtk_css_style_property_get_initial_value (property);
- goto restart;
+ color_compute (property,
+ computed,
+ context,
+ _gtk_css_style_property_get_initial_value (property));
}
}
@@ -446,7 +443,6 @@ css_image_value_compute (GtkCssStyleProperty *property,
if (image)
image = _gtk_css_image_compute (image, context);
- g_value_init (computed, GTK_TYPE_CSS_IMAGE);
g_value_take_object (computed, image);
}
@@ -465,7 +461,6 @@ compute_border_width (GtkCssStyleProperty *property,
style = _gtk_css_style_property_lookup_by_id (_gtk_css_style_property_get_id (property) - 1);
border_style = g_value_get_enum (_gtk_style_context_peek_property (context, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (style))));
- g_value_init (computed, G_TYPE_INT);
if (border_style == GTK_BORDER_STYLE_NONE ||
border_style == GTK_BORDER_STYLE_HIDDEN)
g_value_set_int (computed, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]