LibWeb: Remove special handling of all property for animations

There were a couple places that we had special handling for the `all`
property but since d31a58a was merged we can treat it the same as any
other shorthand
This commit is contained in:
Callum Law 2025-10-30 20:28:25 +13:00 committed by Alexander Kalenik
parent 56e2ac8a9d
commit ed0b741a26
Notes: github-actions[bot] 2025-11-02 22:55:35 +00:00
4 changed files with 17 additions and 35 deletions

View file

@ -152,30 +152,21 @@ static WebIDL::ExceptionOr<KeyframeType<AL>> process_a_keyframe_like_object(JS::
auto input_properties = TRY(keyframe_object.enumerable_own_property_names(JS::Object::PropertyKind::Key));
Vector<String> animation_properties;
Optional<JS::Value> all_value;
for (auto const& input_property : input_properties) {
if (!input_property.is_string())
continue;
auto name = input_property.as_string().utf8_string();
if (name == "all"sv) {
all_value = TRY(keyframe_object.get(vm.names.all));
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
auto property = static_cast<CSS::PropertyID>(i);
if (CSS::is_animatable_property(property))
animation_properties.append(String { CSS::string_from_property_id(property) });
}
} else {
// Handle the two special cases
if (name == "cssFloat"sv || name == "cssOffset"sv) {
// Handle the two special cases
if (name == "cssFloat"sv || name == "cssOffset"sv) {
animation_properties.append(name);
} else if (name == "float"sv || name == "offset"sv) {
// Ignore these property names
} else if (auto property = CSS::property_id_from_camel_case_string(name); property.has_value()) {
if (CSS::is_animatable_property(property.value()))
animation_properties.append(name);
} else if (name == "float"sv || name == "offset"sv) {
// Ignore these property names
} else if (auto property = CSS::property_id_from_camel_case_string(name); property.has_value()) {
if (CSS::is_animatable_property(property.value()))
animation_properties.append(name);
}
}
}
@ -188,7 +179,7 @@ static WebIDL::ExceptionOr<KeyframeType<AL>> process_a_keyframe_like_object(JS::
// as the property key and keyframe input as the receiver.
// 2. Check the completion record of raw value.
JS::PropertyKey key { Utf16FlyString::from_utf8(property_name), JS::PropertyKey::StringMayBeNumber::No };
auto raw_value = TRY(keyframe_object.has_property(key)) ? TRY(keyframe_object.get(key)) : *all_value;
auto raw_value = TRY(keyframe_object.get(key));
using PropertyValuesType = Conditional<AL == AllowLists::Yes, Vector<String>, String>;
PropertyValuesType property_values;

View file

@ -5146,15 +5146,11 @@ RefPtr<StyleValue const> Parser::parse_transition_property_value(TokenStream<Com
StyleValueVector transition_properties;
for (auto const& value : transition_property_values) {
TokenStream transition_property_tokens { value };
if (auto all_keyword_value = parse_all_as_single_keyword_value(transition_property_tokens, Keyword::All)) {
transition_properties.append(*all_keyword_value);
} else {
auto custom_ident = parse_custom_ident_value(transition_property_tokens, { { "all"sv, "none"sv } });
if (!custom_ident || transition_property_tokens.has_next_token())
return nullptr;
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());
}
transition_properties.append(custom_ident.release_nonnull());
}
transaction.commit();
return StyleValueList::create(move(transition_properties), StyleValueList::Separator::Comma);

View file

@ -3888,10 +3888,9 @@
"initial": "all",
"multiplicity": "coordinating-list",
"valid-types": [
"custom-ident ![all,none]"
"custom-ident ![none]"
],
"valid-identifiers": [
"all",
"none"
]
},

View file

@ -1314,13 +1314,9 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
};
if (property_value->is_keyword()) {
auto keyword = property_value->as_keyword().keyword();
if (keyword == Keyword::None) {
properties.append({});
continue;
}
if (keyword == Keyword::All)
properties_for_this_transition = expanded_longhands_for_shorthand(PropertyID::All);
VERIFY(property_value->to_keyword() == Keyword::None);
properties.append({});
continue;
} else {
auto maybe_property = property_id_from_string(property_value->as_custom_ident().custom_ident());
if (!maybe_property.has_value()) {