styleproperty: require property in _gtk_style_property_parse_value()

Other code uses _gtk_css_style_parse_value() instead now.
This commit is contained in:
Benjamin Otte
2012-01-02 00:14:23 +01:00
parent 30eb26087c
commit 389531d15d
3 changed files with 50 additions and 52 deletions

View File

@ -28,6 +28,7 @@
#include "gtkcssproviderprivate.h" #include "gtkcssproviderprivate.h"
#include "gtkbitmaskprivate.h" #include "gtkbitmaskprivate.h"
#include "gtkcssstylefuncsprivate.h"
#include "gtkcssparserprivate.h" #include "gtkcssparserprivate.h"
#include "gtkcsssectionprivate.h" #include "gtkcsssectionprivate.h"
#include "gtkcssselectorprivate.h" #include "gtkcssselectorprivate.h"
@ -1485,8 +1486,7 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
gtk_css_section_get_file (val->section), gtk_css_section_get_file (val->section),
g_value_get_string (&val->value)); g_value_get_string (&val->value));
found = _gtk_style_property_parse_value (NULL, found = _gtk_css_style_parse_value (value,
value,
scanner->parser, scanner->parser,
NULL); NULL);

View File

@ -26,6 +26,7 @@
#include <math.h> #include <math.h>
#include "gtkborderimageprivate.h" #include "gtkborderimageprivate.h"
#include "gtkcssstylefuncsprivate.h"
#include "gtkcsstypesprivate.h" #include "gtkcsstypesprivate.h"
/* this is in case round() is not provided by the compiler, /* this is in case round() is not provided by the compiler,
@ -54,7 +55,7 @@ border_image_value_parse (GtkCssParser *parser,
g_value_init (&temp, CAIRO_GOBJECT_TYPE_PATTERN); g_value_init (&temp, CAIRO_GOBJECT_TYPE_PATTERN);
if (!_gtk_style_property_parse_value (NULL, &temp, parser, base)) if (!_gtk_css_style_parse_value (&temp, parser, base))
return FALSE; return FALSE;
boxed_type = G_VALUE_TYPE (&temp); boxed_type = G_VALUE_TYPE (&temp);
@ -66,7 +67,7 @@ border_image_value_parse (GtkCssParser *parser,
g_value_unset (&temp); g_value_unset (&temp);
g_value_init (&temp, GTK_TYPE_BORDER); g_value_init (&temp, GTK_TYPE_BORDER);
if (!_gtk_style_property_parse_value (NULL, &temp, parser, base)) if (!_gtk_css_style_parse_value (&temp, parser, base))
goto out; goto out;
parsed_slice = g_value_get_boxed (&temp); parsed_slice = g_value_get_boxed (&temp);
@ -77,7 +78,7 @@ border_image_value_parse (GtkCssParser *parser,
g_value_unset (&temp); g_value_unset (&temp);
g_value_init (&temp, GTK_TYPE_BORDER); g_value_init (&temp, GTK_TYPE_BORDER);
if (!_gtk_style_property_parse_value (NULL, &temp, parser, base)) if (!_gtk_css_style_parse_value (&temp, parser, base))
goto out; goto out;
width = g_value_dup_boxed (&temp); width = g_value_dup_boxed (&temp);
@ -86,7 +87,7 @@ border_image_value_parse (GtkCssParser *parser,
g_value_unset (&temp); g_value_unset (&temp);
g_value_init (&temp, GTK_TYPE_CSS_BORDER_IMAGE_REPEAT); g_value_init (&temp, GTK_TYPE_CSS_BORDER_IMAGE_REPEAT);
if (!_gtk_style_property_parse_value (NULL, &temp, parser, base)) if (!_gtk_css_style_parse_value (&temp, parser, base))
goto out; goto out;
parsed_repeat = g_value_get_boxed (&temp); parsed_repeat = g_value_get_boxed (&temp);

View File

@ -385,11 +385,10 @@ _gtk_style_property_parse_value (GtkStyleProperty *property,
GtkCssParser *parser, GtkCssParser *parser,
GFile *base) GFile *base)
{ {
g_return_val_if_fail (GTK_IS_STYLE_PROPERTY (property), FALSE);
g_return_val_if_fail (value != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (parser != NULL, FALSE); g_return_val_if_fail (parser != NULL, FALSE);
if (property)
{
if (_gtk_css_parser_try (parser, "initial", TRUE)) if (_gtk_css_parser_try (parser, "initial", TRUE))
{ {
/* the initial value can be explicitly specified with the /* the initial value can be explicitly specified with the
@ -429,11 +428,9 @@ _gtk_style_property_parse_value (GtkStyleProperty *property,
return success; return success;
} }
else if (property->parse_func)
if (property->parse_func)
return (* property->parse_func) (parser, base, value); return (* property->parse_func) (parser, base, value);
} else
return _gtk_css_style_parse_value (value, parser, base); return _gtk_css_style_parse_value (value, parser, base);
} }