From be3f352b593e59cf5f784fb3929acacf09f4d9c0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 Feb 2021 21:36:22 -0500 Subject: [PATCH] cssshadowvalue: Add a parsing function Add a variant of the parse function that parses just a single (non-box) shadow, as required for the drop-shadow filter. --- gtk/gtkcssshadowvalue.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index f4d60c9bcd..3afc9592a0 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -514,19 +514,14 @@ fail: } GtkCssValue * -_gtk_css_shadow_value_parse_filter (GtkCssParser *parser) +gtk_css_shadow_value_parse_filter (GtkCssParser *parser) { - GtkCssValue *result; + ShadowValue shadow; - result = _gtk_css_shadow_value_parse (parser, FALSE); - - if (result && result->n_shadows != 1) - { - gtk_css_parser_error_syntax (parser, "A single shadow is required"); - g_clear_pointer (&result, gtk_css_value_unref); - } - - return result; + if (gtk_css_shadow_value_parse_one (parser, FALSE, &shadow)) + return gtk_css_shadow_value_new (&shadow, 1); + else + return NULL; } void