[gtk/wip/otte/css] css: Review most error messages
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/css] css: Review most error messages
- Date: Tue, 9 Apr 2019 04:30:35 +0000 (UTC)
commit 1e37d94784fcac5ab0e3b56c21e4e8070551b410
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 9 05:40:50 2019 +0200
css: Review most error messages
... and move them from _gtk_css_parser_error() to the proper new error
message.
gtk/gtkcssbordervalue.c | 2 +-
gtk/gtkcsscalcvalue.c | 12 ++-----
gtk/gtkcsseasevalue.c | 8 ++---
gtk/gtkcssfiltervalue.c | 2 +-
gtk/gtkcssfontfeaturesvalue.c | 2 +-
gtk/gtkcssfontvariationsvalue.c | 2 +-
gtk/gtkcssimage.c | 2 +-
gtk/gtkcssimagebuiltin.c | 2 +-
gtk/gtkcssimagecrossfade.c | 4 +--
gtk/gtkcssimagefallback.c | 4 +--
gtk/gtkcssimageicontheme.c | 2 +-
gtk/gtkcssimagelinear.c | 12 +++----
gtk/gtkcssimageradial.c | 6 ++--
gtk/gtkcssimagerecolor.c | 7 ++--
gtk/gtkcssimagescaled.c | 2 +-
gtk/gtkcsskeyframes.c | 11 +++----
gtk/gtkcsspositionvalue.c | 6 ++--
gtk/gtkcssstylepropertyimpl.c | 58 +++++++++++++++++-----------------
gtk/gtkcsstransformvalue.c | 2 +-
testsuite/css/parser/test-css-parser.c | 2 ++
20 files changed, 70 insertions(+), 78 deletions(-)
---
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 1bc8aaeefc..3c45ad8146 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -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;
}
diff --git a/gtk/gtkcsscalcvalue.c b/gtk/gtkcsscalcvalue.c
index aed0326fb6..fa5b46cc27 100644
--- a/gtk/gtkcsscalcvalue.c
+++ b/gtk/gtkcsscalcvalue.c
@@ -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;
}
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index cdf8e96bde..4d79f4fe29 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -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;
}
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c
index a07535c948..ad9f2e6554 100644
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -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;
}
diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c
index 5f7dce764b..67110a878c 100644
--- a/gtk/gtkcssfontfeaturesvalue.c
+++ b/gtk/gtkcssfontfeaturesvalue.c
@@ -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;
diff --git a/gtk/gtkcssfontvariationsvalue.c b/gtk/gtkcssfontvariationsvalue.c
index 537ebb1d6e..ed6dfd8e3b 100644
--- a/gtk/gtkcssfontvariationsvalue.c
+++ b/gtk/gtkcssfontvariationsvalue.c
@@ -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;
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index b1e6d3b6e0..6b4fc40a25 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -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;
}
diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c
index 1c58da816a..d8d3efa699 100644
--- a/gtk/gtkcssimagebuiltin.c
+++ b/gtk/gtkcssimagebuiltin.c
@@ -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;
}
diff --git a/gtk/gtkcssimagecrossfade.c b/gtk/gtkcssimagecrossfade.c
index 2577468ed5..4b8e9832fd 100644
--- a/gtk/gtkcssimagecrossfade.c
+++ b/gtk/gtkcssimagecrossfade.c
@@ -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;
}
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index c33912e00f..6536a8dd0a 100644
--- a/gtk/gtkcssimagefallback.c
+++ b/gtk/gtkcssimagefallback.c
@@ -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;
}
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 3cea6ee0b2..5a194862b0 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -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;
}
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index ef3ab75ed1..6c79da2978 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -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;
}
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index 77e820171d..930fc5b6e0 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -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;
}
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 2027b4ecc5..d4e0bd3d3c 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -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 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;
}
diff --git a/gtk/gtkcssimagescaled.c b/gtk/gtkcssimagescaled.c
index 6e01464a6f..5fce72949b 100644
--- a/gtk/gtkcssimagescaled.c
+++ b/gtk/gtkcssimagescaled.c
@@ -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;
}
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index 16d0e5efda..e4a577379d 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -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
{
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index 280ddc38f8..473ae56ca9 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -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;
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 07b446b86e..5d0906ed7e 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -226,7 +226,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;
}
@@ -250,13 +250,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 ||
- _gtk_css_number_value_get (value, 100) > 1000)
+ 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);
}
}
@@ -280,7 +280,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;
}
@@ -301,7 +301,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;
}
@@ -321,7 +321,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;
}
@@ -339,7 +339,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;
}
@@ -374,7 +374,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;
}
@@ -392,7 +392,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;
}
@@ -428,7 +428,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;
}
@@ -447,7 +447,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;
}
@@ -459,7 +459,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;
}
@@ -471,7 +471,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;
}
@@ -499,7 +499,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;
@@ -507,7 +507,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;
}
@@ -519,7 +519,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;
}
@@ -531,7 +531,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;
}
@@ -550,7 +550,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;
@@ -558,7 +558,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;
}
@@ -570,7 +570,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;
}
@@ -589,7 +589,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;
@@ -597,7 +597,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;
}
@@ -744,7 +744,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;
}
@@ -794,7 +794,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;
}
@@ -876,7 +876,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;
}
@@ -895,7 +895,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;
}
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index 7e4b220b74..ca6b2c778b 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -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;
}
diff --git a/testsuite/css/parser/test-css-parser.c b/testsuite/css/parser/test-css-parser.c
index 311243d369..23ef2bf2fa 100644
--- a/testsuite/css/parser/test-css-parser.c
+++ b/testsuite/css/parser/test-css-parser.c
@@ -152,6 +152,8 @@ parsing_error_cb (GtkCssProvider *provider,
if (error->domain == GTK_CSS_PARSER_ERROR)
append_error_value (errors, GTK_TYPE_CSS_PARSER_ERROR, error->code);
+ else if (error->domain == GTK_CSS_PARSER_WARNING)
+ append_error_value (errors, GTK_TYPE_CSS_PARSER_WARNING, error->code);
else
g_string_append_printf (errors,
"%s %u\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]