mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-25 12:32:53 +00:00
LibWeb: Allow transition-property
with multiple values
This commit is contained in:
parent
5d48652890
commit
1f8f3804a3
Notes:
github-actions[bot]
2025-04-23 20:04:28 +00:00
Author: https://github.com/tcl3
Commit: 1f8f3804a3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4387
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 65 additions and 0 deletions
|
@ -670,6 +670,10 @@ Parser::ParseErrorOr<NonnullRefPtr<CSSStyleValue const>> Parser::parse_css_value
|
|||
if (auto parsed_value = parse_transition_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::TransitionProperty:
|
||||
if (auto parsed_value = parse_transition_property_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::Translate:
|
||||
if (auto parsed_value = parse_translate_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
|
@ -3775,6 +3779,33 @@ RefPtr<CSSStyleValue const> Parser::parse_transition_value(TokenStream<Component
|
|||
return TransitionStyleValue::create(move(transitions));
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue const> Parser::parse_transition_property_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
// https://drafts.csswg.org/css-transitions/#transition-property-property
|
||||
// none | <single-transition-property>#
|
||||
|
||||
// none
|
||||
if (auto none = parse_all_as_single_keyword_value(tokens, Keyword::None))
|
||||
return none;
|
||||
|
||||
// <single-transition-property>#
|
||||
// <single-transition-property> = all | <custom-ident>
|
||||
auto transaction = tokens.begin_transaction();
|
||||
auto transition_property_values = parse_a_comma_separated_list_of_component_values(tokens);
|
||||
|
||||
StyleValueVector transition_properties;
|
||||
for (auto const& value : transition_property_values) {
|
||||
TokenStream transition_property_tokens { value };
|
||||
auto custom_ident = parse_custom_ident_value(transition_property_tokens, { { "none"sv } });
|
||||
if (!custom_ident || transition_property_tokens.has_next_token())
|
||||
return nullptr;
|
||||
|
||||
transition_properties.append(custom_ident.release_nonnull());
|
||||
}
|
||||
transaction.commit();
|
||||
return StyleValueList::create(move(transition_properties), StyleValueList::Separator::Comma);
|
||||
}
|
||||
|
||||
RefPtr<CSSStyleValue const> Parser::parse_translate_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
if (tokens.remaining_token_count() == 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue