mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
css: Create a section if the variable does not have one
In case a variable definition does not have a CSS section associated to it, we fall back to the previous behaviour of creating a CSS section with the bounds of the error. See: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/841
This commit is contained in:
parent
3b5f0ed05e
commit
1626c5f1e7
@ -220,6 +220,8 @@ parser_error (GtkCssParser *parser,
|
||||
{
|
||||
for (int i = 0; i < n_vars; i++)
|
||||
{
|
||||
GtkCssSection *section;
|
||||
|
||||
if (names[i + 1])
|
||||
g_set_error (&new_error,
|
||||
GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
@ -228,7 +230,15 @@ parser_error (GtkCssParser *parser,
|
||||
g_set_error_literal (&new_error,
|
||||
GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
error->message);
|
||||
gtk_style_provider_emit_error (provider, vars[i]->section, new_error);
|
||||
|
||||
if (vars[i]->section == NULL)
|
||||
section = gtk_css_section_new (gtk_css_parser_get_file (parser), start, end);
|
||||
else
|
||||
section = gtk_css_section_ref (vars[i]->section);
|
||||
|
||||
gtk_style_provider_emit_error (provider, section, new_error);
|
||||
|
||||
gtk_css_section_unref (section);
|
||||
g_clear_error (&new_error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user