mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibWeb: Clarify naming of TokenStreams in parse_css_value()
Originally, the input was named `tokens`, and we later created a `tokens_without_whitespace` from the filtered contents of `tokens`. Since `tokens_without_whitespace` is what we actually want to use while parsing, let's rename `tokens` -> `unprocessed_tokens` and use the `tokens` name for the processed ones.
This commit is contained in:
parent
81daf1752b
commit
cd9344d4c1
1 changed files with 6 additions and 6 deletions
|
@ -5652,18 +5652,18 @@ bool block_contains_var_or_attr(Block const& block)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(PropertyID property_id, TokenStream<ComponentValue>& tokens)
|
Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(PropertyID property_id, TokenStream<ComponentValue>& unprocessed_tokens)
|
||||||
{
|
{
|
||||||
m_context.set_current_property_id(property_id);
|
m_context.set_current_property_id(property_id);
|
||||||
Vector<ComponentValue> component_values;
|
Vector<ComponentValue> component_values;
|
||||||
bool contains_var_or_attr = false;
|
bool contains_var_or_attr = false;
|
||||||
bool const property_accepts_custom_ident = property_accepts_type(property_id, ValueType::CustomIdent);
|
bool const property_accepts_custom_ident = property_accepts_type(property_id, ValueType::CustomIdent);
|
||||||
|
|
||||||
while (tokens.has_next_token()) {
|
while (unprocessed_tokens.has_next_token()) {
|
||||||
auto const& token = tokens.next_token();
|
auto const& token = unprocessed_tokens.next_token();
|
||||||
|
|
||||||
if (token.is(Token::Type::Semicolon)) {
|
if (token.is(Token::Type::Semicolon)) {
|
||||||
tokens.reconsume_current_input_token();
|
unprocessed_tokens.reconsume_current_input_token();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5697,6 +5697,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special-case property handling
|
// Special-case property handling
|
||||||
|
auto tokens = TokenStream { component_values };
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PropertyID::AspectRatio:
|
case PropertyID::AspectRatio:
|
||||||
if (auto parsed_value = parse_aspect_ratio_value(component_values))
|
if (auto parsed_value = parse_aspect_ratio_value(component_values))
|
||||||
|
@ -5778,8 +5779,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
case PropertyID::FontFamily: {
|
case PropertyID::FontFamily: {
|
||||||
auto tokens_without_whitespace = TokenStream { component_values };
|
if (auto parsed_value = parse_font_family_value(tokens))
|
||||||
if (auto parsed_value = parse_font_family_value(tokens_without_whitespace))
|
|
||||||
return parsed_value.release_nonnull();
|
return parsed_value.release_nonnull();
|
||||||
return ParseError::SyntaxError;
|
return ParseError::SyntaxError;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue