diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c index b4a53f5633..07ab3eacf5 100644 --- a/gtk/gtkcssimagelinear.c +++ b/gtk/gtkcssimagelinear.c @@ -352,6 +352,14 @@ gtk_css_image_linear_parse (GtkCssImage *image, } while (_gtk_css_parser_try (parser, ",", TRUE)); + if (linear->stops->len < 2) + { + _gtk_css_parser_error_full (parser, + GTK_CSS_PROVIDER_ERROR_DEPRECATED, + "Using one color stop with %s() is deprecated.", + linear->repeating ? "repeating-linear-gradient" : "linear-gradient"); + } + if (!_gtk_css_parser_try (parser, ")", TRUE)) { _gtk_css_parser_error (parser, "Missing closing bracket at end of linear gradient"); diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c index bc137db7da..81967c9a80 100644 --- a/gtk/gtkcssimageradial.c +++ b/gtk/gtkcssimageradial.c @@ -377,6 +377,14 @@ gtk_css_image_radial_parse (GtkCssImage *image, } while (_gtk_css_parser_try (parser, ",", TRUE)); + if (radial->stops->len < 2) + { + _gtk_css_parser_error_full (parser, + GTK_CSS_PROVIDER_ERROR_DEPRECATED, + "Using one color stop with %s() is deprecated.", + radial->repeating ? "repeating-radial-gradient" : "radial-gradient"); + } + if (!_gtk_css_parser_try (parser, ")", TRUE)) { _gtk_css_parser_error (parser, "Missing closing bracket at end of radial gradient");