css: Add a helper function for parsing

This will be helpful in gradient parsing code, where the color
interpolation is optional.
This commit is contained in:
Matthias Clasen 2024-06-16 08:40:57 -04:00
parent 57073e1057
commit 500a3a6dee
2 changed files with 8 additions and 0 deletions

View File

@ -1009,6 +1009,12 @@ parse_hue_interpolation (GtkCssParser *parser,
return TRUE; return TRUE;
} }
gboolean
gtk_css_color_interpolation_method_can_parse (GtkCssParser *parser)
{
return gtk_css_token_is_ident (gtk_css_parser_get_token (parser), "in");
}
gboolean gboolean
gtk_css_color_interpolation_method_parse (GtkCssParser *parser, gtk_css_color_interpolation_method_parse (GtkCssParser *parser,
GtkCssColorSpace *in, GtkCssColorSpace *in,

View File

@ -105,6 +105,8 @@ void gtk_css_color_space_get_coord_range (GtkCssColorSpace color_space,
float *lower, float *lower,
float *upper); float *upper);
gboolean gtk_css_color_interpolation_method_can_parse (GtkCssParser *parser);
gboolean gtk_css_color_interpolation_method_parse (GtkCssParser *parser, gboolean gtk_css_color_interpolation_method_parse (GtkCssParser *parser,
GtkCssColorSpace *in, GtkCssColorSpace *in,
GtkCssHueInterpolation *interp); GtkCssHueInterpolation *interp);