diff options
author | Benjamin Otte <otte@redhat.com> | 2012-07-11 06:56:07 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-08-28 15:40:56 +0200 |
commit | 9b953829fbf1332d00c2ca8a99c7da5e4bda8c64 (patch) | |
tree | d11d83a1dbe54909d5ee729a77b55bfa4393649d /gtk/gtkcssbgsizevalue.c | |
parent | 3f00801e9aedd971378a6aad70e945903db7a798 (diff) | |
download | gtk+-9b953829fbf1332d00c2ca8a99c7da5e4bda8c64.tar.gz |
css: Introduce _gtk_css_value_compute()
This commit is essentially a large reorganization. Instead of all value
subtypes having their own compute function, there is the general
_gtk_css_value_compute() function that then calls a vfunc on the
subtype.
Diffstat (limited to 'gtk/gtkcssbgsizevalue.c')
-rw-r--r-- | gtk/gtkcssbgsizevalue.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c index 24e0fae039..2ba0eb110a 100644 --- a/gtk/gtkcssbgsizevalue.c +++ b/gtk/gtkcssbgsizevalue.c @@ -40,6 +40,17 @@ gtk_css_value_bg_size_free (GtkCssValue *value) g_slice_free (GtkCssValue, value); } +GtkCssValue * +gtk_css_value_bg_size_compute (GtkCssValue *value, + GtkStyleContext *context) +{ + if (value->x == NULL && value->y == NULL) + return _gtk_css_value_ref (value); + + return _gtk_css_bg_size_value_new (value->x ? _gtk_css_value_compute (value->x, context) : NULL, + value->y ? _gtk_css_value_compute (value->y, context) : NULL); +} + static gboolean gtk_css_value_bg_size_equal (const GtkCssValue *value1, const GtkCssValue *value2) @@ -119,6 +130,7 @@ gtk_css_value_bg_size_print (const GtkCssValue *value, static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = { gtk_css_value_bg_size_free, + gtk_css_value_bg_size_compute, gtk_css_value_bg_size_equal, gtk_css_value_bg_size_transition, gtk_css_value_bg_size_print @@ -243,16 +255,3 @@ _gtk_css_bg_size_value_compute_size (const GtkCssValue *value, out_width, out_height); } -GtkCssValue * -_gtk_css_bg_size_value_compute (GtkCssValue *value, - GtkStyleContext *context) -{ - g_return_val_if_fail (value->class == >K_CSS_VALUE_BG_SIZE, NULL); - - if (value->x == NULL && value->y == NULL) - return _gtk_css_value_ref (value); - - return _gtk_css_bg_size_value_new (value->x ? _gtk_css_number_value_compute (value->x, context) : NULL, - value->y ? _gtk_css_number_value_compute (value->y, context) : NULL); -} - |