mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-30 02:57:38 +00:00
styleproperty: require property in _gtk_style_property_parse_value()
Other code uses _gtk_css_style_parse_value() instead now.
This commit is contained in:
parent
30eb26087c
commit
389531d15d
@ -28,6 +28,7 @@
|
||||
#include "gtkcssproviderprivate.h"
|
||||
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcssstylefuncsprivate.h"
|
||||
#include "gtkcssparserprivate.h"
|
||||
#include "gtkcsssectionprivate.h"
|
||||
#include "gtkcssselectorprivate.h"
|
||||
@ -1485,10 +1486,9 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
gtk_css_section_get_file (val->section),
|
||||
g_value_get_string (&val->value));
|
||||
|
||||
found = _gtk_style_property_parse_value (NULL,
|
||||
value,
|
||||
scanner->parser,
|
||||
NULL);
|
||||
found = _gtk_css_style_parse_value (value,
|
||||
scanner->parser,
|
||||
NULL);
|
||||
|
||||
gtk_css_scanner_destroy (scanner);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "gtkborderimageprivate.h"
|
||||
#include "gtkcssstylefuncsprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
|
||||
/* 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);
|
||||
|
||||
if (!_gtk_style_property_parse_value (NULL, &temp, parser, base))
|
||||
if (!_gtk_css_style_parse_value (&temp, parser, base))
|
||||
return FALSE;
|
||||
|
||||
boxed_type = G_VALUE_TYPE (&temp);
|
||||
@ -66,7 +67,7 @@ border_image_value_parse (GtkCssParser *parser,
|
||||
g_value_unset (&temp);
|
||||
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;
|
||||
|
||||
parsed_slice = g_value_get_boxed (&temp);
|
||||
@ -77,7 +78,7 @@ border_image_value_parse (GtkCssParser *parser,
|
||||
g_value_unset (&temp);
|
||||
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;
|
||||
|
||||
width = g_value_dup_boxed (&temp);
|
||||
@ -86,7 +87,7 @@ border_image_value_parse (GtkCssParser *parser,
|
||||
g_value_unset (&temp);
|
||||
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;
|
||||
|
||||
parsed_repeat = g_value_get_boxed (&temp);
|
||||
|
@ -385,56 +385,53 @@ _gtk_style_property_parse_value (GtkStyleProperty *property,
|
||||
GtkCssParser *parser,
|
||||
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 (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
|
||||
* ‘initial’ keyword which all properties accept.
|
||||
*/
|
||||
g_value_unset (value);
|
||||
g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
|
||||
g_value_set_enum (value, GTK_CSS_INITIAL);
|
||||
return TRUE;
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||
{
|
||||
/* All properties accept the ‘inherit’ value which
|
||||
* explicitly specifies that the value will be determined
|
||||
* by inheritance. The ‘inherit’ value can be used to
|
||||
* strengthen inherited values in the cascade, and it can
|
||||
* also be used on properties that are not normally inherited.
|
||||
*/
|
||||
g_value_unset (value);
|
||||
g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
|
||||
g_value_set_enum (value, GTK_CSS_INHERIT);
|
||||
return TRUE;
|
||||
}
|
||||
else if (property->property_parse_func)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *value_str;
|
||||
gboolean success;
|
||||
|
||||
value_str = _gtk_css_parser_read_value (parser);
|
||||
if (value_str == NULL)
|
||||
return FALSE;
|
||||
|
||||
success = (*property->property_parse_func) (value_str, value, &error);
|
||||
|
||||
g_free (value_str);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
if (property->parse_func)
|
||||
return (* property->parse_func) (parser, base, value);
|
||||
/* the initial value can be explicitly specified with the
|
||||
* ‘initial’ keyword which all properties accept.
|
||||
*/
|
||||
g_value_unset (value);
|
||||
g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
|
||||
g_value_set_enum (value, GTK_CSS_INITIAL);
|
||||
return TRUE;
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||
{
|
||||
/* All properties accept the ‘inherit’ value which
|
||||
* explicitly specifies that the value will be determined
|
||||
* by inheritance. The ‘inherit’ value can be used to
|
||||
* strengthen inherited values in the cascade, and it can
|
||||
* also be used on properties that are not normally inherited.
|
||||
*/
|
||||
g_value_unset (value);
|
||||
g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
|
||||
g_value_set_enum (value, GTK_CSS_INHERIT);
|
||||
return TRUE;
|
||||
}
|
||||
else if (property->property_parse_func)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *value_str;
|
||||
gboolean success;
|
||||
|
||||
value_str = _gtk_css_parser_read_value (parser);
|
||||
if (value_str == NULL)
|
||||
return FALSE;
|
||||
|
||||
success = (*property->property_parse_func) (value_str, value, &error);
|
||||
|
||||
return _gtk_css_style_parse_value (value, parser, base);
|
||||
g_free (value_str);
|
||||
|
||||
return success;
|
||||
}
|
||||
else if (property->parse_func)
|
||||
return (* property->parse_func) (parser, base, value);
|
||||
else
|
||||
return _gtk_css_style_parse_value (value, parser, base);
|
||||
}
|
||||
|
||||
GParameter *
|
||||
|
Loading…
Reference in New Issue
Block a user