mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
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:
parent
56e2ac8a9d
commit
ed0b741a26
Notes:
github-actions[bot]
2025-11-02 22:55:35 +00:00
Author: https://github.com/Calme1709
Commit: ed0b741a26
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6642
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 17 additions and 35 deletions
|
|
@ -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));
|
auto input_properties = TRY(keyframe_object.enumerable_own_property_names(JS::Object::PropertyKind::Key));
|
||||||
|
|
||||||
Vector<String> animation_properties;
|
Vector<String> animation_properties;
|
||||||
Optional<JS::Value> all_value;
|
|
||||||
|
|
||||||
for (auto const& input_property : input_properties) {
|
for (auto const& input_property : input_properties) {
|
||||||
if (!input_property.is_string())
|
if (!input_property.is_string())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto name = input_property.as_string().utf8_string();
|
auto name = input_property.as_string().utf8_string();
|
||||||
if (name == "all"sv) {
|
|
||||||
all_value = TRY(keyframe_object.get(vm.names.all));
|
// Handle the two special cases
|
||||||
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
|
if (name == "cssFloat"sv || name == "cssOffset"sv) {
|
||||||
auto property = static_cast<CSS::PropertyID>(i);
|
animation_properties.append(name);
|
||||||
if (CSS::is_animatable_property(property))
|
} else if (name == "float"sv || name == "offset"sv) {
|
||||||
animation_properties.append(String { CSS::string_from_property_id(property) });
|
// Ignore these property names
|
||||||
}
|
} else if (auto property = CSS::property_id_from_camel_case_string(name); property.has_value()) {
|
||||||
} else {
|
if (CSS::is_animatable_property(property.value()))
|
||||||
// Handle the two special cases
|
|
||||||
if (name == "cssFloat"sv || name == "cssOffset"sv) {
|
|
||||||
animation_properties.append(name);
|
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.
|
// as the property key and keyframe input as the receiver.
|
||||||
// 2. Check the completion record of raw value.
|
// 2. Check the completion record of raw value.
|
||||||
JS::PropertyKey key { Utf16FlyString::from_utf8(property_name), JS::PropertyKey::StringMayBeNumber::No };
|
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>;
|
using PropertyValuesType = Conditional<AL == AllowLists::Yes, Vector<String>, String>;
|
||||||
PropertyValuesType property_values;
|
PropertyValuesType property_values;
|
||||||
|
|
|
||||||
|
|
@ -5146,15 +5146,11 @@ RefPtr<StyleValue const> Parser::parse_transition_property_value(TokenStream<Com
|
||||||
StyleValueVector transition_properties;
|
StyleValueVector transition_properties;
|
||||||
for (auto const& value : transition_property_values) {
|
for (auto const& value : transition_property_values) {
|
||||||
TokenStream transition_property_tokens { value };
|
TokenStream transition_property_tokens { value };
|
||||||
if (auto all_keyword_value = parse_all_as_single_keyword_value(transition_property_tokens, Keyword::All)) {
|
auto custom_ident = parse_custom_ident_value(transition_property_tokens, { { "none"sv } });
|
||||||
transition_properties.append(*all_keyword_value);
|
if (!custom_ident || transition_property_tokens.has_next_token())
|
||||||
} else {
|
return nullptr;
|
||||||
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;
|
|
||||||
|
|
||||||
transition_properties.append(custom_ident.release_nonnull());
|
transition_properties.append(custom_ident.release_nonnull());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
return StyleValueList::create(move(transition_properties), StyleValueList::Separator::Comma);
|
return StyleValueList::create(move(transition_properties), StyleValueList::Separator::Comma);
|
||||||
|
|
|
||||||
|
|
@ -3888,10 +3888,9 @@
|
||||||
"initial": "all",
|
"initial": "all",
|
||||||
"multiplicity": "coordinating-list",
|
"multiplicity": "coordinating-list",
|
||||||
"valid-types": [
|
"valid-types": [
|
||||||
"custom-ident ![all,none]"
|
"custom-ident ![none]"
|
||||||
],
|
],
|
||||||
"valid-identifiers": [
|
"valid-identifiers": [
|
||||||
"all",
|
|
||||||
"none"
|
"none"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1314,13 +1314,9 @@ static void compute_transitioned_properties(ComputedProperties const& style, DOM
|
||||||
};
|
};
|
||||||
|
|
||||||
if (property_value->is_keyword()) {
|
if (property_value->is_keyword()) {
|
||||||
auto keyword = property_value->as_keyword().keyword();
|
VERIFY(property_value->to_keyword() == Keyword::None);
|
||||||
if (keyword == Keyword::None) {
|
properties.append({});
|
||||||
properties.append({});
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (keyword == Keyword::All)
|
|
||||||
properties_for_this_transition = expanded_longhands_for_shorthand(PropertyID::All);
|
|
||||||
} else {
|
} else {
|
||||||
auto maybe_property = property_id_from_string(property_value->as_custom_ident().custom_ident());
|
auto maybe_property = property_id_from_string(property_value->as_custom_ident().custom_ident());
|
||||||
if (!maybe_property.has_value()) {
|
if (!maybe_property.has_value()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue