cssstyleproperty: Get rid of unused API

Both _gtk_css_style_property_print_value() and
_gtk_css_style_property_compute_value() aren't necessary anymore and are
replaced by _gtk_css_value_print() and _gtk_css_value_comptue()
respectively.
This commit is contained in:
Benjamin Otte 2012-07-16 14:28:58 +02:00
parent 36c79712a1
commit 6dc3113edc
5 changed files with 25 additions and 84 deletions

View File

@ -155,10 +155,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
if (specified) if (specified)
{ {
g_ptr_array_index (values->values, id) = g_ptr_array_index (values->values, id) = _gtk_css_value_compute (specified, id, context);
_gtk_css_style_property_compute_value (prop,
context,
specified);
} }
else else
{ {

View File

@ -2839,7 +2839,7 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
g_string_append (str, " "); g_string_append (str, " ");
g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop->property))); g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop->property)));
g_string_append (str, ": "); g_string_append (str, ": ");
_gtk_css_style_property_print_value (prop->property, prop->value, str); _gtk_css_value_print (prop->value, str);
g_string_append (str, ";\n"); g_string_append (str, ";\n");
} }

View File

@ -226,28 +226,10 @@ gtk_css_style_property_real_parse_value (GtkCssStyleProperty *property,
return NULL; return NULL;
} }
static void
gtk_css_style_property_real_print_value (GtkCssStyleProperty *property,
const GtkCssValue *value,
GString *string)
{
_gtk_css_value_print (value, string);
}
static GtkCssValue *
gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
GtkCssValue *specified)
{
return _gtk_css_value_compute (specified, _gtk_css_style_property_get_id (property), context);
}
static void static void
_gtk_css_style_property_init (GtkCssStyleProperty *property) _gtk_css_style_property_init (GtkCssStyleProperty *property)
{ {
property->parse_value = gtk_css_style_property_real_parse_value; property->parse_value = gtk_css_style_property_real_parse_value;
property->print_value = gtk_css_style_property_real_print_value;
property->compute_value = gtk_css_style_property_real_compute_value;
} }
/** /**
@ -371,52 +353,3 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
return property->initial_value; return property->initial_value;
} }
/**
* _gtk_css_style_property_compute_value:
* @property: the property
* @computed: (out): an uninitialized value to be filled with the result
* @context: the context to use for resolving
* @specified: the value to compute from
*
* Converts the @specified value into the @computed value using the
* information in @context. This step is explained in detail in
* <ulink url="http://www.w3.org/TR/css3-cascade/#computed>
* the CSS documentation</ulink>.
**/
GtkCssValue *
_gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
GtkCssValue *specified)
{
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), NULL);
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
return property->compute_value (property, context, specified);
}
/**
* _gtk_css_style_property_print_value:
* @property: the property
* @value: the value to print
* @string: the string to print to
*
* Prints @value to the given @string in CSS format. The @value must be a
* valid specified value as parsed using the parse functions or as assigned
* via _gtk_style_property_assign().
**/
void
_gtk_css_style_property_print_value (GtkCssStyleProperty *property,
GtkCssValue *value,
GString *string)
{
g_return_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property));
g_return_if_fail (value != NULL);
g_return_if_fail (string != NULL);
if (_gtk_css_value_is_inherit (value) ||
_gtk_css_value_is_initial (value))
_gtk_css_value_print (value, string);
else
property->print_value (property, value, string);
}

View File

@ -36,12 +36,6 @@ typedef struct _GtkCssStylePropertyClass GtkCssStylePropertyClass;
typedef GtkCssValue * (* GtkCssStylePropertyParseFunc) (GtkCssStyleProperty *property, typedef GtkCssValue * (* GtkCssStylePropertyParseFunc) (GtkCssStyleProperty *property,
GtkCssParser *parser); GtkCssParser *parser);
typedef void (* GtkCssStylePropertyPrintFunc) (GtkCssStyleProperty *property,
const GtkCssValue *value,
GString *string);
typedef GtkCssValue * (* GtkCssStylePropertyComputeFunc)(GtkCssStyleProperty *property,
GtkStyleContext *context,
GtkCssValue *specified);
typedef void (* GtkCssStylePropertyQueryFunc) (GtkCssStyleProperty *property, typedef void (* GtkCssStylePropertyQueryFunc) (GtkCssStyleProperty *property,
const GtkCssValue *cssvalue, const GtkCssValue *cssvalue,
GValue *value); GValue *value);
@ -57,8 +51,6 @@ struct _GtkCssStyleProperty
guint animated :1; guint animated :1;
GtkCssStylePropertyParseFunc parse_value; GtkCssStylePropertyParseFunc parse_value;
GtkCssStylePropertyPrintFunc print_value;
GtkCssStylePropertyComputeFunc compute_value;
GtkCssStylePropertyQueryFunc query_value; GtkCssStylePropertyQueryFunc query_value;
GtkCssStylePropertyAssignFunc assign_value; GtkCssStylePropertyAssignFunc assign_value;
}; };
@ -83,10 +75,6 @@ guint _gtk_css_style_property_get_id (GtkCssStyleProp
GtkCssValue * _gtk_css_style_property_get_initial_value GtkCssValue * _gtk_css_style_property_get_initial_value
(GtkCssStyleProperty *property); (GtkCssStyleProperty *property);
GtkCssValue * _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
GtkStyleContext *context,
GtkCssValue *specified);
void _gtk_css_style_property_print_value (GtkCssStyleProperty *property, void _gtk_css_style_property_print_value (GtkCssStyleProperty *property,
GtkCssValue *value, GtkCssValue *value,
GString *string); GString *string);

View File

@ -61,6 +61,20 @@ _gtk_css_value_unref (GtkCssValue *value)
value->class->free (value); value->class->free (value);
} }
/**
* _gtk_css_value_compute:
* @value: the value to compute from
* @property_id: the ID of the property to compute
* @context: the context to use for resolving
*
* Converts the specified @value into the computed value for the CSS
* property given by @property_id using the information in @context.
* This step is explained in detail in
* <ulink url="http://www.w3.org/TR/css3-cascade/#computed>
* the CSS documentation</ulink>.
*
* Returns: the comptued value
**/
GtkCssValue * GtkCssValue *
_gtk_css_value_compute (GtkCssValue *value, _gtk_css_value_compute (GtkCssValue *value,
guint property_id, guint property_id,
@ -124,6 +138,15 @@ _gtk_css_value_to_string (const GtkCssValue *value)
return g_string_free (string, FALSE); return g_string_free (string, FALSE);
} }
/**
* _gtk_css_value_print:
* @value: the value to print
* @string: the string to print to
*
* Prints @value to the given @string in CSS format. The @value must be a
* valid specified value as parsed using the parse functions or as assigned
* via _gtk_style_property_assign().
**/
void void
_gtk_css_value_print (const GtkCssValue *value, _gtk_css_value_print (const GtkCssValue *value,
GString *string) GString *string)