mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
LibWeb: Implement the transition-behavior
CSS property
This specifies whether transitions should be started for transitions whose animation behavior is discrete.
This commit is contained in:
parent
e57e38dafc
commit
542c3cbe51
Notes:
github-actions[bot]
2025-05-02 10:08:20 +00:00
Author: https://github.com/tcl3
Commit: 542c3cbe51
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4508
Reviewed-by: https://github.com/AtkinsSJ ✅
20 changed files with 289 additions and 47 deletions
|
@ -3724,7 +3724,7 @@ RefPtr<CSSStyleValue const> Parser::parse_transition_value(TokenStream<Component
|
|||
while (tokens.has_next_token()) {
|
||||
TransitionStyleValue::Transition transition;
|
||||
auto time_value_count = 0;
|
||||
|
||||
bool transition_behavior_found = false;
|
||||
while (tokens.has_next_token() && !tokens.next_token().is(Token::Type::Comma)) {
|
||||
if (auto maybe_time = parse_time(tokens); maybe_time.has_value()) {
|
||||
auto time = maybe_time.release_value();
|
||||
|
@ -3757,6 +3757,14 @@ RefPtr<CSSStyleValue const> Parser::parse_transition_value(TokenStream<Component
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!transition_behavior_found && (tokens.peek_token().is_ident("normal"sv) || tokens.peek_token().is_ident("allow-discrete"sv))) {
|
||||
transition_behavior_found = true;
|
||||
auto ident = tokens.consume_a_token().token().ident();
|
||||
if (ident == "allow-discrete"sv)
|
||||
transition.transition_behavior = TransitionBehavior::AllowDiscrete;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto token = tokens.peek_token(); token.is_ident("all"sv)) {
|
||||
auto transition_keyword = parse_keyword_value(tokens);
|
||||
VERIFY(transition_keyword->to_keyword() == Keyword::All);
|
||||
|
@ -3775,10 +3783,10 @@ RefPtr<CSSStyleValue const> Parser::parse_transition_value(TokenStream<Component
|
|||
}
|
||||
|
||||
auto custom_ident = transition_property->custom_ident();
|
||||
if (auto property = property_id_from_string(custom_ident); property.has_value())
|
||||
if (auto property = property_id_from_string(custom_ident); property.has_value()) {
|
||||
transition.property_name = CustomIdentStyleValue::create(custom_ident);
|
||||
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Transition property has unexpected token \"{}\"", tokens.next_token().to_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue