css: Move computing of initial and inherit values

... to the compute vfunc. Simplifies code quite a bit. But makes the
code no longer a simple step-by-step implementation of the spec.
This commit is contained in:
Benjamin Otte
2012-07-17 14:01:52 +02:00
parent 6dc3113edc
commit 9e7e65ca6e
5 changed files with 24 additions and 81 deletions

View File

@ -19,6 +19,8 @@
#include "gtkcssinitialvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
};
@ -35,8 +37,9 @@ gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleContext *context)
{
/* This value should be caught further up */
g_return_val_if_reached (_gtk_css_value_ref (value));
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
property_id,
context);
}
static gboolean
@ -76,11 +79,3 @@ _gtk_css_initial_value_new (void)
{
return _gtk_css_value_ref (&initial);
}
gboolean
_gtk_css_value_is_initial (const GtkCssValue *value)
{
g_return_val_if_fail (value != NULL, FALSE);
return value == &initial;
}