css provider: Set sections on all variable values

We were doing it in one case, but forgetting it in another.
These sections are necessary to report meaningful error locations
when parsing property values at compute time.
This commit is contained in:
Matthias Clasen 2024-05-08 19:49:37 -04:00 committed by Alice Mikhaylenko
parent 496aee5b02
commit 77028362ab

View File

@ -928,12 +928,31 @@ parse_declaration (GtkCssScanner *scanner,
if (gtk_css_parser_has_references (scanner->parser))
{
GtkCssLocation start_location;
GtkCssVariableValue *var_value;
gtk_css_parser_skip_whitespace (scanner->parser);
if (gtk_keep_css_sections)
start_location = *gtk_css_parser_get_start_location (scanner->parser);
var_value = gtk_css_parser_parse_value_into_token_stream (scanner->parser);
if (var_value == NULL)
goto out;
if (gtk_keep_css_sections)
section = gtk_css_section_new (gtk_css_parser_get_file (scanner->parser),
&start_location,
gtk_css_parser_get_start_location (scanner->parser));
else
section = NULL;
if (section != NULL)
{
gtk_css_variable_value_set_section (var_value, section);
gtk_css_section_unref (section);
}
if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);