mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
LibWeb: Comment discrepancy from spec in consume_a_declaration()
We're calling this in a way that is incorrect, and so the algorithm's assumption that the next token is an `<ident-token>` is wrong, and we have to handle that failing. Ideally we would just stop calling this incorrectly, but until then, let's actually document what is happening.
This commit is contained in:
parent
999cc51512
commit
5a23965e93
1 changed files with 3 additions and 0 deletions
|
@ -1776,6 +1776,7 @@ NonnullRefPtr<StyleFunctionRule> Parser::consume_a_function(TokenStream<T>& toke
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 5.4.6. Consume a declaration
|
||||||
// https://www.w3.org/TR/css-syntax-3/#consume-declaration
|
// https://www.w3.org/TR/css-syntax-3/#consume-declaration
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tokens)
|
Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tokens)
|
||||||
|
@ -1790,6 +1791,8 @@ Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tok
|
||||||
auto start_position = tokens.position();
|
auto start_position = tokens.position();
|
||||||
auto& token = tokens.next_token();
|
auto& token = tokens.next_token();
|
||||||
|
|
||||||
|
// Note: Not to spec, handle the case where the input token *isn't* an <ident-token>.
|
||||||
|
// FIXME: Perform this check before calling consume_a_declaration().
|
||||||
if (!token.is(Token::Type::Ident)) {
|
if (!token.is(Token::Type::Ident)) {
|
||||||
tokens.rewind_to_position(start_position);
|
tokens.rewind_to_position(start_position);
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue