1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00

LibWeb: Validate time values when parsing transition value

This commit is contained in:
Tim Ledbetter 2025-03-12 17:56:04 +00:00 committed by Jelle Raaijmakers
parent 37eb2be348
commit 6298ec6be4
Notes: github-actions[bot] 2025-03-14 07:53:28 +00:00
3 changed files with 46 additions and 3 deletions

View file

@ -3791,13 +3791,18 @@ RefPtr<CSSStyleValue> Parser::parse_transition_value(TokenStream<ComponentValue>
auto time_value_count = 0;
while (tokens.has_next_token() && !tokens.next_token().is(Token::Type::Comma)) {
if (auto time = parse_time(tokens); time.has_value()) {
if (auto maybe_time = parse_time(tokens); maybe_time.has_value()) {
auto time = maybe_time.release_value();
switch (time_value_count) {
case 0:
transition.duration = time.release_value();
if (!time.is_calculated() && !property_accepts_time(PropertyID::TransitionDuration, time.value()))
return nullptr;
transition.duration = move(time);
break;
case 1:
transition.delay = time.release_value();
if (!time.is_calculated() && !property_accepts_time(PropertyID::TransitionDelay, time.value()))
return nullptr;
transition.delay = move(time);
break;
default:
dbgln_if(CSS_PARSER_DEBUG, "Transition property has more than two time values");