csscolorvalue: Actually discard invalid rgb() colors

This commit is contained in:
Alice Mikhaylenko 2024-05-21 22:25:20 +04:00
parent 1bd208d937
commit aed9cc1874

View File

@ -1029,7 +1029,8 @@ gtk_css_color_value_parse (GtkCssParser *parser)
has_alpha = gtk_css_parser_has_function (parser, "rgba");
parse_color_function (parser, has_alpha, has_alpha, parse_rgba_color_channel, &data);
if (!parse_color_function (parser, has_alpha, has_alpha, parse_rgba_color_channel, &data))
return NULL;
return gtk_css_color_value_new_literal (&rgba);
}
@ -1040,7 +1041,7 @@ gtk_css_color_value_parse (GtkCssParser *parser)
hsla.alpha = 1.0;
if (!parse_color_function (parser, TRUE, FALSE, parse_hsla_color_channel, &hsla))
return FALSE;
return NULL;
_gdk_rgba_init_from_hsla (&rgba, &hsla);