Skip to content

Commit 9afb523

Browse files
Calme1709AtkinsSJ
authored andcommitted
LibWeb: Remove unnecessary parse_list_of_time_values function
We can achieve the same thing by using `parse_simple_comma_separated_value_list`
1 parent b0ab94c commit 9afb523

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

Libraries/LibWeb/CSS/Parser/Parser.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,6 @@ class Parser {
539539
RefPtr<StyleValue const> parse_white_space_trim_value(TokenStream<ComponentValue>&);
540540
RefPtr<StyleValue const> parse_will_change_value(TokenStream<ComponentValue>&);
541541

542-
RefPtr<StyleValue const> parse_list_of_time_values(PropertyID, TokenStream<ComponentValue>&);
543-
544542
RefPtr<CalculationNode const> convert_to_calculation_node(CalcParsing::Node const&, CalculationContext const&);
545543
RefPtr<CalculationNode const> parse_a_calculation(Vector<ComponentValue> const&, CalculationContext const&);
546544

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -743,11 +743,10 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
743743
return parse_all_as(tokens, [this](auto& tokens) { return parse_transform_origin_value(tokens); });
744744
case PropertyID::Transition:
745745
return parse_all_as(tokens, [this](auto& tokens) { return parse_transition_value(tokens); });
746-
case PropertyID::TransitionDelay:
747-
case PropertyID::TransitionDuration:
748-
return parse_all_as(tokens, [this, property_id](auto& tokens) { return parse_list_of_time_values(property_id, tokens); });
749746
case PropertyID::TransitionProperty:
750747
return parse_all_as(tokens, [this](auto& tokens) { return parse_transition_property_value(tokens); });
748+
case PropertyID::TransitionDelay:
749+
case PropertyID::TransitionDuration:
751750
case PropertyID::TransitionTimingFunction:
752751
case PropertyID::TransitionBehavior:
753752
return parse_all_as(tokens, [this, property_id](auto& tokens) { return parse_simple_comma_separated_value_list(property_id, tokens); });
@@ -5073,27 +5072,6 @@ RefPtr<StyleValue const> Parser::parse_transition_value(TokenStream<ComponentVal
50735072
return parsed_value;
50745073
}
50755074

5076-
RefPtr<StyleValue const> Parser::parse_list_of_time_values(PropertyID property_id, TokenStream<ComponentValue>& tokens)
5077-
{
5078-
auto transaction = tokens.begin_transaction();
5079-
auto time_values = parse_a_comma_separated_list_of_component_values(tokens);
5080-
StyleValueVector time_value_list;
5081-
for (auto const& value : time_values) {
5082-
TokenStream time_value_tokens { value };
5083-
auto time_style_value = parse_time_value(time_value_tokens);
5084-
if (!time_style_value)
5085-
return nullptr;
5086-
if (time_value_tokens.has_next_token())
5087-
return nullptr;
5088-
if (!time_style_value->is_calculated() && !property_accepts_time(property_id, time_style_value->as_time().time()))
5089-
return nullptr;
5090-
time_value_list.append(*time_style_value);
5091-
}
5092-
5093-
transaction.commit();
5094-
return StyleValueList::create(move(time_value_list), StyleValueList::Separator::Comma);
5095-
}
5096-
50975075
RefPtr<StyleValue const> Parser::parse_transition_property_value(TokenStream<ComponentValue>& tokens)
50985076
{
50995077
// https://drafts.csswg.org/css-transitions/#transition-property-property

0 commit comments

Comments
 (0)