Skip to content

Commit 63d2f57

Browse files
committed
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 e1e86e2 commit 63d2f57

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
@@ -532,8 +532,6 @@ class Parser {
532532
RefPtr<StyleValue const> parse_white_space_trim_value(TokenStream<ComponentValue>&);
533533
RefPtr<StyleValue const> parse_will_change_value(TokenStream<ComponentValue>&);
534534

535-
RefPtr<StyleValue const> parse_list_of_time_values(PropertyID, TokenStream<ComponentValue>&);
536-
537535
RefPtr<CalculationNode const> convert_to_calculation_node(CalcParsing::Node const&, CalculationContext const&);
538536
RefPtr<CalculationNode const> parse_a_calculation(Vector<ComponentValue> const&, CalculationContext const&);
539537

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -731,11 +731,10 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
731731
return parse_all_as(tokens, [this](auto& tokens) { return parse_transform_origin_value(tokens); });
732732
case PropertyID::Transition:
733733
return parse_all_as(tokens, [this](auto& tokens) { return parse_transition_value(tokens); });
734-
case PropertyID::TransitionDelay:
735-
case PropertyID::TransitionDuration:
736-
return parse_all_as(tokens, [this, property_id](auto& tokens) { return parse_list_of_time_values(property_id, tokens); });
737734
case PropertyID::TransitionProperty:
738735
return parse_all_as(tokens, [this](auto& tokens) { return parse_transition_property_value(tokens); });
736+
case PropertyID::TransitionDelay:
737+
case PropertyID::TransitionDuration:
739738
case PropertyID::TransitionTimingFunction:
740739
case PropertyID::TransitionBehavior:
741740
return parse_all_as(tokens, [this, property_id](auto& tokens) { return parse_simple_comma_separated_value_list(property_id, tokens); });
@@ -4992,27 +4991,6 @@ RefPtr<StyleValue const> Parser::parse_transition_value(TokenStream<ComponentVal
49924991
return parsed_value;
49934992
}
49944993

4995-
RefPtr<StyleValue const> Parser::parse_list_of_time_values(PropertyID property_id, TokenStream<ComponentValue>& tokens)
4996-
{
4997-
auto transaction = tokens.begin_transaction();
4998-
auto time_values = parse_a_comma_separated_list_of_component_values(tokens);
4999-
StyleValueVector time_value_list;
5000-
for (auto const& value : time_values) {
5001-
TokenStream time_value_tokens { value };
5002-
auto time_style_value = parse_time_value(time_value_tokens);
5003-
if (!time_style_value)
5004-
return nullptr;
5005-
if (time_value_tokens.has_next_token())
5006-
return nullptr;
5007-
if (!time_style_value->is_calculated() && !property_accepts_time(property_id, time_style_value->as_time().time()))
5008-
return nullptr;
5009-
time_value_list.append(*time_style_value);
5010-
}
5011-
5012-
transaction.commit();
5013-
return StyleValueList::create(move(time_value_list), StyleValueList::Separator::Comma);
5014-
}
5015-
50164994
RefPtr<StyleValue const> Parser::parse_transition_property_value(TokenStream<ComponentValue>& tokens)
50174995
{
50184996
// https://drafts.csswg.org/css-transitions/#transition-property-property

0 commit comments

Comments
 (0)