diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c index 93f494ef54..608e126ffe 100644 --- a/gtk/gtkcsscolorvalue.c +++ b/gtk/gtkcsscolorvalue.c @@ -348,7 +348,7 @@ apply_shade (const GdkRGBA *in, static inline double transition (double start, double end, - double progress) + double progress) { return start + (end - start) * progress; } @@ -664,6 +664,29 @@ gtk_css_color_value_new_current_color (void) /* }}} */ /* {{{ Parsing */ +gboolean +gtk_css_color_value_can_parse (GtkCssParser *parser) +{ + /* This is way too generous, but meh... */ + return gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_IDENT) + || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_AT_KEYWORD) + || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_HASH_ID) + || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_HASH_UNRESTRICTED) + || gtk_css_parser_has_function (parser, "lighter") + || gtk_css_parser_has_function (parser, "darker") + || gtk_css_parser_has_function (parser, "shade") + || gtk_css_parser_has_function (parser, "alpha") + || gtk_css_parser_has_function (parser, "mix") + || gtk_css_parser_has_function (parser, "hsl") + || gtk_css_parser_has_function (parser, "hsla") + || gtk_css_parser_has_function (parser, "rgb") + || gtk_css_parser_has_function (parser, "rgba") + || gtk_css_parser_has_function (parser, "hwb") + || gtk_css_parser_has_function (parser, "oklab") + || gtk_css_parser_has_function (parser, "oklch") + || gtk_css_parser_has_function (parser, "color"); +} + typedef struct { GtkCssValue *color; @@ -727,29 +750,6 @@ parse_color_number (GtkCssParser *parser, } } -gboolean -gtk_css_color_value_can_parse (GtkCssParser *parser) -{ - /* This is way too generous, but meh... */ - return gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_IDENT) - || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_AT_KEYWORD) - || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_HASH_ID) - || gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_HASH_UNRESTRICTED) - || gtk_css_parser_has_function (parser, "lighter") - || gtk_css_parser_has_function (parser, "darker") - || gtk_css_parser_has_function (parser, "shade") - || gtk_css_parser_has_function (parser, "alpha") - || gtk_css_parser_has_function (parser, "mix") - || gtk_css_parser_has_function (parser, "hsl") - || gtk_css_parser_has_function (parser, "hsla") - || gtk_css_parser_has_function (parser, "rgb") - || gtk_css_parser_has_function (parser, "rgba") - || gtk_css_parser_has_function (parser, "hwb") - || gtk_css_parser_has_function (parser, "oklab") - || gtk_css_parser_has_function (parser, "oklch") - || gtk_css_parser_has_function (parser, "color"); -} - typedef struct { GdkRGBA *rgba; diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c index 1defc7eda4..96cd1b1d36 100644 --- a/gtk/gtkcssnumbervalue.c +++ b/gtk/gtkcssnumbervalue.c @@ -1015,11 +1015,11 @@ gtk_css_number_value_multiply (GtkCssValue *value, break; } - return gtk_css_math_value_new (TYPE_PRODUCT, 0, - (GtkCssValue *[]) { - gtk_css_value_ref (value), - gtk_css_number_value_new (factor, GTK_CSS_NUMBER) - }, 2); + return gtk_css_math_value_new (TYPE_PRODUCT, 0, + (GtkCssValue *[]) { + gtk_css_value_ref (value), + gtk_css_number_value_new (factor, GTK_CSS_NUMBER) + }, 2); } GtkCssValue * @@ -1314,7 +1314,7 @@ gtk_css_arg2_value_new (guint type, return gtk_css_dimension_value_new (v, unit); } -/* This funciton is called at parsing time, so units are not +/* This function is called at parsing time, so units are not * canonical, and length values can't necessarily be unified. */ GtkCssValue *