css: Review error messages

... and move them from _gtk_css_parser_error() to the proper new error
message.
This commit is contained in:
Benjamin Otte 2019-04-09 05:40:50 +02:00
parent de73ac980f
commit 1cd9396154
22 changed files with 93 additions and 122 deletions

View File

@ -198,7 +198,7 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
if (i == 0)
{
_gtk_css_parser_error (parser, "Expected a number");
gtk_css_parser_error_syntax (parser, "Expected a number");
_gtk_css_value_unref (result);
return NULL;
}

View File

@ -316,12 +316,6 @@ static GtkCssValue *
gtk_css_calc_value_parse_value (GtkCssParser *parser,
GtkCssNumberParseFlags flags)
{
if (gtk_css_parser_has_function (parser, "calc"))
{
_gtk_css_parser_error (parser, "Nested calc() expressions are not allowed.");
return NULL;
}
if (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_OPEN_PARENS))
{
GtkCssValue *result;
@ -336,7 +330,7 @@ gtk_css_calc_value_parse_value (GtkCssParser *parser,
}
if (!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF))
_gtk_css_parser_error (parser, "Expected closing ')' in calc() subterm");
gtk_css_parser_error_syntax (parser, "Expected closing ')' in calc() subterm");
gtk_css_parser_end_block (parser);
@ -402,7 +396,7 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
if (is_number (result) && !(flags & GTK_CSS_PARSE_NUMBER))
{
_gtk_css_parser_error (parser, "calc() product term has no units");
gtk_css_parser_error_syntax (parser, "calc() product term has no units");
goto fail;
}
@ -491,7 +485,7 @@ gtk_css_calc_value_parse (GtkCssParser *parser,
if (!gtk_css_parser_has_function (parser, "calc"))
{
_gtk_css_parser_error (parser, "Expected 'calc('");
gtk_css_parser_error_syntax (parser, "Expected 'calc('");
return NULL;
}

View File

@ -238,7 +238,7 @@ gtk_css_ease_value_parse_cubic_bezier_arg (GtkCssParser *parser,
{
if (values[arg] < 0 || values[arg] > 1.0)
{
_gtk_css_parser_error (parser, "value %g out of range. Must be from 0.0 to 1.0", values[arg]);
gtk_css_parser_error_value (parser, "value %g out of range. Must be from 0.0 to 1.0", values[arg]);
return 0;
}
}
@ -279,7 +279,7 @@ gtk_css_ease_value_parse_steps_arg (GtkCssParser *parser,
}
else if (data->n_steps < 1)
{
_gtk_css_parser_error (parser, "Number of steps must be > 0");
gtk_css_parser_error_value (parser, "Number of steps must be > 0");
return 0;
}
return 1;
@ -291,7 +291,7 @@ gtk_css_ease_value_parse_steps_arg (GtkCssParser *parser,
data->start = FALSE;
else
{
_gtk_css_parser_error (parser, "Only allowed values are 'start' and 'end'");
gtk_css_parser_error_syntax (parser, "Only allowed values are 'start' and 'end'");
return 0;
}
return 1;
@ -347,7 +347,7 @@ _gtk_css_ease_value_parse (GtkCssParser *parser)
}
}
_gtk_css_parser_error (parser, "Unknown value");
gtk_css_parser_error_syntax (parser, "Expected a valid ease value");
return NULL;
}

View File

@ -860,7 +860,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser)
if (array->len == 0)
{
_gtk_css_parser_error (parser, "Expected a filter");
gtk_css_parser_error_syntax (parser, "Expected a filter");
goto fail;
}

View File

@ -245,7 +245,7 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
if (!is_valid_opentype_tag (name))
{
_gtk_css_parser_error (parser, "Not a valid OpenType tag.");
gtk_css_parser_error_value (parser, "Not a valid OpenType tag.");
g_free (name);
_gtk_css_value_unref (result);
return NULL;

View File

@ -243,7 +243,7 @@ gtk_css_font_variations_value_parse (GtkCssParser *parser)
if (!is_valid_opentype_tag (name))
{
_gtk_css_parser_error (parser, "Not a valid OpenType tag.");
gtk_css_parser_error_value (parser, "Not a valid OpenType tag.");
g_free (name);
_gtk_css_value_unref (result);
return NULL;

View File

@ -548,7 +548,7 @@ _gtk_css_image_new_parse (GtkCssParser *parser)
image_type = gtk_css_image_get_parser_type (parser);
if (image_type == G_TYPE_INVALID)
{
_gtk_css_parser_error (parser, "Not a valid image");
gtk_css_parser_error_syntax (parser, "Not a valid image");
return NULL;
}

View File

@ -459,7 +459,7 @@ gtk_css_image_builtin_parse (GtkCssImage *image,
{
if (!gtk_css_parser_try_ident (parser, "builtin"))
{
_gtk_css_parser_error (parser, "Expected 'builtin'");
gtk_css_parser_error_syntax (parser, "Expected 'builtin'");
return FALSE;
}

View File

@ -294,7 +294,7 @@ parse_progress (GtkCssParser *parser,
if (*progress > 1.0)
{
_gtk_css_parser_error (parser, "Percentages over 100%% are not allowed");
gtk_css_parser_error_value (parser, "Percentages over 100%% are not allowed");
return FALSE;
}
@ -348,7 +348,7 @@ gtk_css_image_cross_fade_parse (GtkCssImage *image,
{
if (!gtk_css_parser_has_function (parser, "cross-fade"))
{
_gtk_css_parser_error (parser, "Expected 'cross-fade('");
gtk_css_parser_error_syntax (parser, "Expected 'cross-fade('");
return FALSE;
}

View File

@ -190,7 +190,7 @@ gtk_css_image_fallback_parse_arg (GtkCssParser *parser,
if (data->color != NULL)
{
_gtk_css_parser_error (parser, "The color must be the last parameter");
gtk_css_parser_error_syntax (parser, "The color must be the last parameter");
return 0;
}
else if (_gtk_css_image_can_parse (parser))
@ -221,7 +221,7 @@ gtk_css_image_fallback_parse (GtkCssImage *image,
if (!gtk_css_parser_has_function (parser, "image"))
{
_gtk_css_parser_error (parser, "Expected 'image('");
gtk_css_parser_error_syntax (parser, "Expected 'image('");
return FALSE;
}

View File

@ -146,7 +146,7 @@ gtk_css_image_icon_theme_parse (GtkCssImage *image,
{
if (!gtk_css_parser_has_function (parser, "-gtk-icontheme"))
{
_gtk_css_parser_error (parser, "Expected '-gtk-icontheme('");
gtk_css_parser_error_syntax (parser, "Expected '-gtk-icontheme('");
return FALSE;
}

View File

@ -299,7 +299,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
{
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
{
_gtk_css_parser_error (parser, "Expected 'top', 'bottom' or comma");
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
return 0;
}
linear->side |= (1 << GTK_CSS_LEFT);
@ -308,7 +308,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
{
if (linear->side & ((1 << GTK_CSS_LEFT) | (1 << GTK_CSS_RIGHT)))
{
_gtk_css_parser_error (parser, "Expected 'top', 'bottom' or comma");
gtk_css_parser_error_syntax (parser, "Expected 'top', 'bottom' or comma");
return 0;
}
linear->side |= (1 << GTK_CSS_RIGHT);
@ -317,7 +317,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
{
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
{
_gtk_css_parser_error (parser, "Expected 'left', 'right' or comma");
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
return 0;
}
linear->side |= (1 << GTK_CSS_TOP);
@ -326,7 +326,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
{
if (linear->side & ((1 << GTK_CSS_TOP) | (1 << GTK_CSS_BOTTOM)))
{
_gtk_css_parser_error (parser, "Expected 'left', 'right' or comma");
gtk_css_parser_error_syntax (parser, "Expected 'left', 'right' or comma");
return 0;
}
linear->side |= (1 << GTK_CSS_BOTTOM);
@ -337,7 +337,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
if (linear->side == 0)
{
_gtk_css_parser_error (parser, "Expected side that gradient should go to");
gtk_css_parser_error_syntax (parser, "Expected side that gradient should go to");
return 0;
}
@ -387,7 +387,7 @@ gtk_css_image_linear_parse (GtkCssImage *image,
self->repeating = FALSE;
else
{
_gtk_css_parser_error (parser, "Not a linear gradient");
gtk_css_parser_error_syntax (parser, "Not a linear gradient");
return FALSE;
}

View File

@ -359,13 +359,13 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
{
if (radial->sizes[0] && radial->sizes[1])
{
_gtk_css_parser_error (parser, "Circular gradient can only have one size");
gtk_css_parser_error_syntax (parser, "Circular gradient can only have one size");
return 0;
}
if (radial->sizes[0] && gtk_css_number_value_has_percent (radial->sizes[0]))
{
_gtk_css_parser_error (parser, "Circular gradient cannot have percentage as size");
gtk_css_parser_error_syntax (parser, "Circular gradient cannot have percentage as size");
return 0;
}
}
@ -411,7 +411,7 @@ gtk_css_image_radial_parse (GtkCssImage *image,
self->repeating = FALSE;
else
{
_gtk_css_parser_error (parser, "Not a radial gradient");
gtk_css_parser_error_syntax (parser, "Not a radial gradient");
return FALSE;
}

View File

@ -253,10 +253,7 @@ gtk_css_image_recolor_parse_arg (GtkCssParser *parser,
case 1:
self->palette = gtk_css_palette_value_parse (parser);
if (self->palette == NULL)
{
_gtk_css_parser_error (parser, "A palette is required here");
return 0;
}
return 1;
default:
@ -271,7 +268,7 @@ gtk_css_image_recolor_parse (GtkCssImage *image,
{
if (!gtk_css_parser_has_function (parser, "-gtk-recolor"))
{
_gtk_css_parser_error (parser, "Expected '-gtk-recolor('");
gtk_css_parser_error_syntax (parser, "Expected '-gtk-recolor('");
return FALSE;
}

View File

@ -182,7 +182,7 @@ gtk_css_image_scaled_parse (GtkCssImage *image,
if (!gtk_css_parser_has_function (parser, "-gtk-scaled"))
{
_gtk_css_parser_error (parser, "Expected '-gtk-scaled('");
gtk_css_parser_error_syntax (parser, "Expected '-gtk-scaled('");
return FALSE;
}

View File

@ -234,8 +234,7 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
property = _gtk_style_property_lookup (name);
if (property == NULL)
{
/* should be GTK_CSS_PARSER_ERROR_NAME */
_gtk_css_parser_error (parser, "No property named '%s'", name);
gtk_css_parser_error_value (parser, "No property named '%s'", name);
g_free (name);
return FALSE;
}
@ -244,7 +243,7 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
if (!gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COLON))
{
_gtk_css_parser_error (parser, "Expected a ':'");
gtk_css_parser_error_syntax (parser, "Expected a ':'");
return FALSE;
}
@ -254,7 +253,7 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
if (!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF))
{
_gtk_css_parser_error (parser, "Junk at end of value");
gtk_css_parser_error_syntax (parser, "Junk at end of value");
_gtk_css_value_unref (value);
return FALSE;
}
@ -274,12 +273,12 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
}
if (!animatable)
_gtk_css_parser_error (parser, "shorthand '%s' cannot be animated", _gtk_style_property_get_name (property));
gtk_css_parser_error_value (parser, "shorthand '%s' cannot be animated", _gtk_style_property_get_name (property));
}
else if (GTK_IS_CSS_STYLE_PROPERTY (property))
{
if (!keyframes_set_value (keyframes, k, GTK_CSS_STYLE_PROPERTY (property), value))
_gtk_css_parser_error (parser, "Cannot animate property '%s'", _gtk_style_property_get_name (property));
gtk_css_parser_error_value (parser, "Cannot animate property '%s'", _gtk_style_property_get_name (property));
}
else
{

View File

@ -19,25 +19,6 @@
#include "gtkcssparserprivate.h"
void
_gtk_css_parser_error (GtkCssParser *parser,
const char *format,
...)
{
GtkCssLocation location;
va_list args;
GError *error;
gtk_css_parser_get_location (parser, &location);
va_start (args, format);
error = g_error_new_valist (GTK_CSS_PARSER_ERROR,
GTK_CSS_PARSER_ERROR_FAILED,
format, args);
gtk_css_parser_emit_error (parser, &location, &location, error);
g_error_free (error);
va_end (args);
}
void
_gtk_css_print_string (GString *str,
const char *string)

View File

@ -26,10 +26,6 @@
G_BEGIN_DECLS
void _gtk_css_parser_error (GtkCssParser *parser,
const char *format,
...) G_GNUC_PRINTF (2, 3);
/* XXX: Find better place to put it? */
void _gtk_css_print_string (GString *str,
const char *string);

View File

@ -225,7 +225,7 @@ position_value_parse (GtkCssParser *parser, gboolean try)
else
{
if (!try)
_gtk_css_parser_error (parser, "Unrecognized position value");
gtk_css_parser_error_syntax (parser, "Unrecognized position value");
return NULL;
}
}
@ -246,7 +246,7 @@ position_value_parse (GtkCssParser *parser, gboolean try)
if (missing != &y)
{
if (!try)
_gtk_css_parser_error (parser, "Invalid combination of values");
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
_gtk_css_value_unref (y);
return NULL;
}
@ -271,7 +271,7 @@ position_value_parse (GtkCssParser *parser, gboolean try)
(!names[first].horizontal && !names[second].horizontal))
{
if (!try)
_gtk_css_parser_error (parser, "Invalid combination of values");
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
_gtk_css_value_unref (x);
_gtk_css_value_unref (y);
return NULL;

View File

@ -76,7 +76,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
if (i == 0)
{
_gtk_css_parser_error (parser, "Expected a length");
gtk_css_parser_error_syntax (parser, "Expected a length");
return FALSE;
}
@ -145,7 +145,7 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
if (i == 0)
{
_gtk_css_parser_error (parser, "Expected a number");
gtk_css_parser_error_syntax (parser, "Expected a number");
goto fail;
}
@ -171,7 +171,7 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
if (i == 0)
{
_gtk_css_parser_error (parser, "Expected a number");
gtk_css_parser_error_syntax (parser, "Expected a number");
goto fail;
}
@ -243,7 +243,7 @@ parse_border_style (GtkCssShorthandProperty *shorthand,
if (i == 0)
{
_gtk_css_parser_error (parser, "Expected a border style");
gtk_css_parser_error_syntax (parser, "Expected a border style");
return FALSE;
}
@ -472,11 +472,11 @@ parse_font (GtkCssShorthandProperty *shorthand,
if (_gtk_css_number_value_get (values[3], 100) < 1 ||
_gtk_css_number_value_get (values[3], 100) > 1000)
{
_gtk_css_parser_error (parser, "Font weight values must be between 1 and 1000");
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
g_clear_pointer (&values[3], gtk_css_value_unref);
}
return FALSE;
}
}
parsed_one = parsed_one || values[3] != NULL;
}
@ -489,11 +489,15 @@ parse_font (GtkCssShorthandProperty *shorthand,
while (parsed_one && !value_is_done_parsing (parser));
values[5] = gtk_css_font_size_value_parse (parser);
if (values[5] == NULL)
return FALSE;
have_font_size:
values[0] = gtk_css_font_family_value_parse (parser);
if (values[0] == NULL)
return FALSE;
return values[0] != NULL && values[5] != NULL;
return TRUE;
}
static gboolean
@ -930,13 +934,13 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
parsed_ligature = _gtk_css_font_variant_ligature_try_parse_one (parser, ligatures);
if (parsed_ligature == 0 && ligatures != 0)
{
_gtk_css_parser_error (parser, "Invalid combination of ligature values");
gtk_css_parser_error_value (parser, "Invalid combination of ligature values");
return FALSE;
}
if (parsed_ligature == GTK_CSS_FONT_VARIANT_LIGATURE_NORMAL ||
parsed_ligature == GTK_CSS_FONT_VARIANT_LIGATURE_NONE)
{
_gtk_css_parser_error (parser, "Unexpected ligature value");
gtk_css_parser_error_value (parser, "Unexpected ligature value");
return FALSE;
}
if (parsed_ligature != ligatures)
@ -948,12 +952,12 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
parsed_numeric = _gtk_css_font_variant_numeric_try_parse_one (parser, numeric);
if (parsed_numeric == 0 && numeric != 0)
{
_gtk_css_parser_error (parser, "Invalid combination of numeric values");
gtk_css_parser_error_value (parser, "Invalid combination of numeric values");
return FALSE;
}
if (parsed_numeric == GTK_CSS_FONT_VARIANT_NUMERIC_NORMAL)
{
_gtk_css_parser_error (parser, "Unexpected numeric value");
gtk_css_parser_error_value (parser, "Unexpected numeric value");
return FALSE;
}
if (parsed_numeric != numeric)
@ -965,12 +969,12 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
parsed_east_asian = _gtk_css_font_variant_east_asian_try_parse_one (parser, east_asian);
if (parsed_east_asian == 0 && east_asian != 0)
{
_gtk_css_parser_error (parser, "Invalid combination of east asian values");
gtk_css_parser_error_value (parser, "Invalid combination of east asian values");
return FALSE;
}
if (parsed_east_asian == GTK_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL)
{
_gtk_css_parser_error (parser, "Unexpected east asian value");
gtk_css_parser_error_value (parser, "Unexpected east asian value");
return FALSE;
}
if (parsed_east_asian != east_asian)
@ -986,7 +990,7 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
{
if (_gtk_css_font_variant_position_value_get (values[1]) == GTK_CSS_FONT_VARIANT_POSITION_NORMAL)
{
_gtk_css_parser_error (parser, "Unexpected position value");
gtk_css_parser_error_value (parser, "Unexpected position value");
return FALSE;
}
goto found;
@ -999,7 +1003,7 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
{
if (_gtk_css_font_variant_caps_value_get (values[2]) == GTK_CSS_FONT_VARIANT_CAPS_NORMAL)
{
_gtk_css_parser_error (parser, "Unexpected caps value");
gtk_css_parser_error_value (parser, "Unexpected caps value");
return FALSE;
}
goto found;
@ -1013,14 +1017,14 @@ parse_font_variant (GtkCssShorthandProperty *shorthand,
{
if (_gtk_css_font_variant_alternate_value_get (values[4]) == GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL)
{
_gtk_css_parser_error (parser, "Unexpected alternate value");
gtk_css_parser_error_value (parser, "Unexpected alternate value");
return FALSE;
}
goto found;
}
}
_gtk_css_parser_error (parser, "Unknown value for property");
gtk_css_parser_error_value (parser, "Unknown value for property");
return FALSE;
found:
@ -1034,7 +1038,7 @@ found:
values[0] = _gtk_css_font_variant_ligature_value_new (ligatures);
if (values[0] == NULL)
{
_gtk_css_parser_error (parser, "Invalid combination of ligature values");
gtk_css_parser_error_value (parser, "Invalid combination of ligature values");
return FALSE;
}
}
@ -1044,7 +1048,7 @@ found:
values[3] = _gtk_css_font_variant_numeric_value_new (numeric);
if (values[3] == NULL)
{
_gtk_css_parser_error (parser, "Invalid combination of numeric values");
gtk_css_parser_error_value (parser, "Invalid combination of numeric values");
return FALSE;
}
}
@ -1054,7 +1058,7 @@ found:
values[5] = _gtk_css_font_variant_east_asian_value_new (east_asian);
if (values[5] == NULL)
{
_gtk_css_parser_error (parser, "Invalid combination of east asian values");
gtk_css_parser_error_value (parser, "Invalid combination of east asian values");
return FALSE;
}
}
@ -1068,7 +1072,7 @@ parse_all (GtkCssShorthandProperty *shorthand,
GtkCssValue **values,
GtkCssParser *parser)
{
_gtk_css_parser_error (parser, "The 'all' property can only be set to 'initial', 'inherit' or 'unset'");
gtk_css_parser_error_syntax (parser, "The 'all' property can only be set to 'initial', 'inherit' or 'unset'");
return FALSE;
}

View File

@ -227,7 +227,7 @@ font_style_parse (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_style_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font style value");
return value;
}
@ -251,13 +251,13 @@ font_weight_parse (GtkCssStyleProperty *property,
if (value == NULL)
{
value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
else if (_gtk_css_number_value_get (value, 100) < 1 ||
return NULL;
if (_gtk_css_number_value_get (value, 100) < 1 ||
_gtk_css_number_value_get (value, 100) > 1000)
{
_gtk_css_parser_error (parser, "Font weight values must be between 1 and 1000");
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
g_clear_pointer (&value, gtk_css_value_unref);
}
}
@ -281,7 +281,7 @@ font_stretch_parse (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_stretch_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font stretch value");
return value;
}
@ -302,7 +302,7 @@ parse_border_style (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_border_style_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown border style value");
return value;
}
@ -322,7 +322,7 @@ parse_css_area_one (GtkCssParser *parser)
GtkCssValue *value = _gtk_css_area_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown box value");
return value;
}
@ -340,7 +340,7 @@ parse_one_css_direction (GtkCssParser *parser)
GtkCssValue *value = _gtk_css_direction_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown direction value");
return value;
}
@ -375,7 +375,7 @@ parse_one_css_play_state (GtkCssParser *parser)
GtkCssValue *value = _gtk_css_play_state_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown play state value");
return value;
}
@ -393,7 +393,7 @@ parse_one_css_fill_mode (GtkCssParser *parser)
GtkCssValue *value = _gtk_css_fill_mode_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown fill mode value");
return value;
}
@ -429,7 +429,7 @@ icon_style_parse (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_icon_style_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown icon style value");
return value;
}
@ -448,7 +448,7 @@ parse_text_decoration_line (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_text_decoration_line_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown text decoration line value");
return value;
}
@ -460,7 +460,7 @@ parse_text_decoration_style (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_text_decoration_style_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown text decoration style value");
return value;
}
@ -472,7 +472,7 @@ parse_font_kerning (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_kerning_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font kerning value");
return value;
}
@ -500,7 +500,7 @@ parse_font_variant_ligatures (GtkCssStyleProperty *property,
parsed = _gtk_css_font_variant_ligature_try_parse_one (parser, ligatures);
if (parsed == 0 || parsed == ligatures)
{
_gtk_css_parser_error (parser, "Not a valid value");
gtk_css_parser_error_syntax (parser, "Not a valid value");
return NULL;
}
ligatures = parsed;
@ -508,7 +508,7 @@ parse_font_variant_ligatures (GtkCssStyleProperty *property,
value = _gtk_css_font_variant_ligature_value_new (ligatures);
if (value == NULL)
_gtk_css_parser_error (parser, "Invalid combination of values");
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
return value;
}
@ -520,7 +520,7 @@ parse_font_variant_position (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_variant_position_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font variant position value");
return value;
}
@ -532,7 +532,7 @@ parse_font_variant_caps (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_variant_caps_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font variant caps value");
return value;
}
@ -551,7 +551,7 @@ parse_font_variant_numeric (GtkCssStyleProperty *property,
parsed = _gtk_css_font_variant_numeric_try_parse_one (parser, numeric);
if (parsed == 0 || parsed == numeric)
{
_gtk_css_parser_error (parser, "Not a valid value");
gtk_css_parser_error_syntax (parser, "Not a valid value");
return NULL;
}
numeric = parsed;
@ -559,7 +559,7 @@ parse_font_variant_numeric (GtkCssStyleProperty *property,
value = _gtk_css_font_variant_numeric_value_new (numeric);
if (value == NULL)
_gtk_css_parser_error (parser, "Invalid combination of values");
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
return value;
}
@ -571,7 +571,7 @@ parse_font_variant_alternates (GtkCssStyleProperty *property,
GtkCssValue *value = _gtk_css_font_variant_alternate_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "unknown font variant alternate value");
return value;
}
@ -590,7 +590,7 @@ parse_font_variant_east_asian (GtkCssStyleProperty *property,
parsed = _gtk_css_font_variant_east_asian_try_parse_one (parser, east_asian);
if (parsed == 0 || parsed == east_asian)
{
_gtk_css_parser_error (parser, "Not a valid value");
gtk_css_parser_error_syntax (parser, "Not a valid value");
return NULL;
}
east_asian = parsed;
@ -598,7 +598,7 @@ parse_font_variant_east_asian (GtkCssStyleProperty *property,
value = _gtk_css_font_variant_east_asian_value_new (east_asian);
if (value == NULL)
_gtk_css_parser_error (parser, "Invalid combination of values");
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
return value;
}
@ -745,7 +745,7 @@ border_image_repeat_parse (GtkCssStyleProperty *property,
if (value == NULL)
{
_gtk_css_parser_error (parser, "Not a valid value");
gtk_css_parser_error_syntax (parser, "Not a valid border repeat value");
return NULL;
}
@ -795,7 +795,7 @@ transition_property_parse_one (GtkCssParser *parser)
if (value == NULL)
{
_gtk_css_parser_error (parser, "Expected an identifier");
gtk_css_parser_error_syntax (parser, "Expected an identifier");
return NULL;
}
@ -877,7 +877,7 @@ blend_mode_value_parse_one (GtkCssParser *parser)
GtkCssValue *value = _gtk_css_blend_mode_value_try_parse (parser);
if (value == NULL)
_gtk_css_parser_error (parser, "unknown value for property");
gtk_css_parser_error_syntax (parser, "Unknown blend mode value");
return value;
}
@ -896,7 +896,7 @@ background_repeat_value_parse_one (GtkCssParser *parser)
if (value == NULL)
{
_gtk_css_parser_error (parser, "Not a valid value");
gtk_css_parser_error_syntax (parser, "Unknown repeat value");
return NULL;
}

View File

@ -1176,7 +1176,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
if (array->len == 0)
{
_gtk_css_parser_error (parser, "Expected a transform");
gtk_css_parser_error_syntax (parser, "Expected a transform");
goto fail;
}