forked from AuroraMiddleware/gtk
css: Handle invalid :not() selectors
We weren't correctly ending the ( ) block when encountering an error. Testcases added. Fixes #2281
This commit is contained in:
parent
564e8f483c
commit
292371932b
@ -1396,6 +1396,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
|
||||
else
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Invalid contents of :not() selector");
|
||||
gtk_css_parser_end_block (parser);
|
||||
if (selector)
|
||||
_gtk_css_selector_free (selector);
|
||||
selector = NULL;
|
||||
@ -1406,6 +1407,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
|
||||
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Invalid contents of :not() selector");
|
||||
gtk_css_parser_end_block (parser);
|
||||
if (selector)
|
||||
_gtk_css_selector_free (selector);
|
||||
selector = NULL;
|
||||
|
@ -369,6 +369,9 @@ test_data = [
|
||||
'no-semicolon.ref.css',
|
||||
'not.css',
|
||||
'not.ref.css',
|
||||
'not-unclosed.css',
|
||||
'not-unclosed.errors',
|
||||
'not-unclosed.ref.css',
|
||||
'nth-child.css',
|
||||
'nth-child.ref.css',
|
||||
'opacity.css',
|
||||
|
3
testsuite/css/parser/not-unclosed.css
Normal file
3
testsuite/css/parser/not-unclosed.css
Normal file
@ -0,0 +1,3 @@
|
||||
:not(valid invalid) {}
|
||||
|
||||
:not(
|
3
testsuite/css/parser/not-unclosed.errors
Normal file
3
testsuite/css/parser/not-unclosed.errors
Normal file
@ -0,0 +1,3 @@
|
||||
not-unclosed.css:1:12-19: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
||||
not-unclosed.css:4:1: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
||||
not-unclosed.css:3:2-4:1: error: GTK_CSS_PARSER_WARNING_SYNTAX
|
0
testsuite/css/parser/not-unclosed.ref.css
Normal file
0
testsuite/css/parser/not-unclosed.ref.css
Normal file
Loading…
Reference in New Issue
Block a user