diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c index 54bbea42fd..b5da0677d0 100644 --- a/gtk/gtkcssbgsizevalue.c +++ b/gtk/gtkcssbgsizevalue.c @@ -194,7 +194,7 @@ _gtk_css_bg_size_value_parse (GtkCssParser *parser) if (_gtk_css_parser_try (parser, "auto", TRUE)) y = NULL; - else if (!_gtk_css_parser_has_number (parser)) + else if (!gtk_css_number_value_can_parse (parser)) y = NULL; else { diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c index 7161470063..0b68d86f7a 100644 --- a/gtk/gtkcssbordervalue.c +++ b/gtk/gtkcssbordervalue.c @@ -174,7 +174,7 @@ _gtk_css_border_value_parse (GtkCssParser *parser, if (allow_auto && _gtk_css_parser_try (parser, "auto", TRUE)) continue; - if (!_gtk_css_parser_has_number (parser)) + if (!gtk_css_number_value_can_parse (parser)) break; result->values[i] = _gtk_css_number_value_parse (parser, flags); diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c index 0511ca496d..c4ef38d94d 100644 --- a/gtk/gtkcsscornervalue.c +++ b/gtk/gtkcsscornervalue.c @@ -132,7 +132,7 @@ _gtk_css_corner_value_parse (GtkCssParser *parser) if (x == NULL) return NULL; - if (!_gtk_css_parser_has_number (parser)) + if (!gtk_css_number_value_can_parse (parser)) y = _gtk_css_value_ref (x); else { diff --git a/gtk/gtkcssimagecrossfade.c b/gtk/gtkcssimagecrossfade.c index 1b02af94f7..6677e400f9 100644 --- a/gtk/gtkcssimagecrossfade.c +++ b/gtk/gtkcssimagecrossfade.c @@ -163,7 +163,7 @@ gtk_css_image_cross_fade_parse (GtkCssImage *image, return FALSE; } - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { GtkCssValue *number; diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c index 6b8ff2a8da..b4a53f5633 100644 --- a/gtk/gtkcssimagelinear.c +++ b/gtk/gtkcssimagelinear.c @@ -310,7 +310,7 @@ gtk_css_image_linear_parse (GtkCssImage *image, return FALSE; } } - else if (_gtk_css_parser_has_number (parser)) + else if (gtk_css_number_value_can_parse (parser)) { linear->angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE); if (linear->angle == NULL) @@ -332,7 +332,7 @@ gtk_css_image_linear_parse (GtkCssImage *image, if (stop.color == NULL) return FALSE; - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { stop.offset = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c index 8febdc4d39..bc137db7da 100644 --- a/gtk/gtkcssimageradial.c +++ b/gtk/gtkcssimageradial.c @@ -282,9 +282,9 @@ gtk_css_image_radial_parse (GtkCssImage *image, if (!has_size) { - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) radial->sizes[0] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT); - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) radial->sizes[1] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT); found_one = has_size = radial->sizes[0] != NULL; } @@ -357,7 +357,7 @@ gtk_css_image_radial_parse (GtkCssImage *image, if (stop.color == NULL) return FALSE; - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { stop.offset = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c index a766a631b5..05643d7364 100644 --- a/gtk/gtkcssnumbervalue.c +++ b/gtk/gtkcssnumbervalue.c @@ -48,6 +48,12 @@ _gtk_css_number_value_new (double value, return gtk_css_dimension_value_new (value, unit); } +gboolean +gtk_css_number_value_can_parse (GtkCssParser *parser) +{ + return _gtk_css_parser_has_number (parser); +} + GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *parser, GtkCssNumberParseFlags flags) diff --git a/gtk/gtkcssnumbervalueprivate.h b/gtk/gtkcssnumbervalueprivate.h index dec0f080ad..e45eeaaaa8 100644 --- a/gtk/gtkcssnumbervalueprivate.h +++ b/gtk/gtkcssnumbervalueprivate.h @@ -49,6 +49,7 @@ struct _GtkCssNumberValueClass { GtkCssValue * _gtk_css_number_value_new (double value, GtkCssUnit unit); +gboolean gtk_css_number_value_can_parse (GtkCssParser *parser); GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *parser, GtkCssNumberParseFlags flags); diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c index 6a52ff6c47..9102b16bb0 100644 --- a/gtk/gtkcsspositionvalue.c +++ b/gtk/gtkcsspositionvalue.c @@ -210,7 +210,7 @@ position_value_parse (GtkCssParser *parser, gboolean try) } if (names[first].name == NULL) { - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { missing = &y; x = _gtk_css_number_value_parse (parser, @@ -239,7 +239,7 @@ position_value_parse (GtkCssParser *parser, gboolean try) if (names[second].name == NULL) { - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { if (missing != &y) { diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index c9a02a014c..a1237e5630 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -215,7 +215,7 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser, do { if (values[HOFFSET] == NULL && - _gtk_css_parser_has_number (parser)) + gtk_css_number_value_can_parse (parser)) { values[HOFFSET] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH @@ -229,7 +229,7 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser, if (values[VOFFSET] == NULL) goto fail; - if (_gtk_css_parser_has_number (parser)) + if (gtk_css_number_value_can_parse (parser)) { values[RADIUS] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH @@ -241,7 +241,7 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser, else values[RADIUS] = _gtk_css_number_value_new (0.0, GTK_CSS_PX); - if (box_shadow_mode && _gtk_css_parser_has_number (parser)) + if (box_shadow_mode && gtk_css_number_value_can_parse (parser)) { values[SPREAD] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index f10a180d3a..27ff25b9a4 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -68,7 +68,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand, for (i = 0; i < 4; i++) { - if (!_gtk_css_parser_has_number (parser)) + if (!gtk_css_number_value_can_parse (parser)) break; values[i] = _gtk_css_number_value_parse (parser, flags); @@ -138,7 +138,7 @@ parse_border_radius (GtkCssShorthandProperty *shorthand, for (i = 0; i < 4; i++) { - if (!_gtk_css_parser_has_number (parser)) + if (!gtk_css_number_value_can_parse (parser)) break; x[i] = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY @@ -165,7 +165,7 @@ parse_border_radius (GtkCssShorthandProperty *shorthand, { for (i = 0; i < 4; i++) { - if (!_gtk_css_parser_has_number (parser)) + if (!gtk_css_number_value_can_parse (parser)) break; y[i] = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY @@ -335,7 +335,7 @@ parse_border_side (GtkCssShorthandProperty *shorthand, do { if (values[0] == NULL && - _gtk_css_parser_has_number (parser)) + gtk_css_number_value_can_parse (parser)) { values[0] = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY @@ -377,7 +377,7 @@ parse_border (GtkCssShorthandProperty *shorthand, do { if (values[0] == NULL && - _gtk_css_parser_has_number (parser)) + gtk_css_number_value_can_parse (parser)) { values[0] = _gtk_css_number_value_parse (parser, GTK_CSS_POSITIVE_ONLY @@ -620,7 +620,7 @@ parse_one_transition (GtkCssShorthandProperty *shorthand, { /* the image part */ if (values[2] == NULL && - _gtk_css_parser_has_number (parser) && !_gtk_css_parser_begins_with (parser, '-')) + gtk_css_number_value_can_parse (parser) && !_gtk_css_parser_begins_with (parser, '-')) { GtkCssValue *number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME); @@ -725,7 +725,7 @@ parse_one_animation (GtkCssShorthandProperty *shorthand, values[1] = _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER); } else if ((values[1] == NULL || values[3] == NULL) && - _gtk_css_parser_has_number (parser)) + gtk_css_number_value_can_parse (parser)) { GtkCssValue *value;