summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2019-02-18 00:41:13 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2019-03-10 13:42:03 +0000
commit221e1d2f9b82d0833b81b23f083c96991d8dd805 (patch)
tree2f5c78bae21e174a0e7011afda617aaf9cdb22d3 /src
parent32221bc146be61fba1296c58ed072cdf84b4de6f (diff)
downloadlibcss-221e1d2f9b82d0833b81b23f083c96991d8dd805.tar.gz
libcss-221e1d2f9b82d0833b81b23f083c96991d8dd805.tar.bz2
Parse: only emit start ruleset if there's a brace
Diffstat (limited to 'src')
-rw-r--r--src/parse/parse.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/parse/parse.c b/src/parse/parse.c
index def9895..670b88d 100644
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -906,17 +906,6 @@ css_error parseRuleset(css_parser *parser)
}
break;
case Brace:
-#if !defined(NDEBUG) && defined(DEBUG_EVENTS)
- printf("Begin ruleset\n");
- parserutils_vector_dump(parser->tokens, __func__, tprinter);
-#endif
- if (parser->parseError == false && parser->event != NULL) {
- if (parser->event(CSS_PARSER_START_RULESET,
- parser->tokens, parser->event_pw) ==
- CSS_INVALID)
- parser->parseError = true;
- }
-
if (parser->parseError == true) {
parser_state to = { sMalformedSelector, Initial };
@@ -940,6 +929,26 @@ css_error parseRuleset(css_parser *parser)
return done(parser);
}
+ /* We don't want to emit the brace, so push it back */
+ error = pushBack(parser, token);
+ if (error != CSS_OK)
+ return error;
+
+#if !defined(NDEBUG) && defined(DEBUG_EVENTS)
+ printf("Begin ruleset\n");
+ parserutils_vector_dump(parser->tokens, __func__, tprinter);
+#endif
+ if (parser->parseError == false && parser->event != NULL) {
+ if (parser->event(CSS_PARSER_START_RULESET,
+ parser->tokens, parser->event_pw) ==
+ CSS_INVALID)
+ parser->parseError = true;
+ }
+
+ /* Re-read the brace */
+ error = getToken(parser, &token);
+ if (error != CSS_OK)
+ return error;
state->substate = WS;
/* Fall through */