LibWeb: Simplify assemble_coordinated_value_list

We know that all coordinated value list longhands are parsed as
`StyleValueList`s
This commit is contained in:
Callum Law
2025-11-29 15:29:20 +13:00
committed by Sam Atkins
parent 74e6c5074f
commit 38efc39e17
Notes: github-actions[bot] 2025-12-02 12:48:23 +00:00

View File

@@ -378,20 +378,11 @@ HashMap<PropertyID, StyleValueVector> ComputedProperties::assemble_coordinated_v
// - If a coordinating list property has too few values specified, its value list is repeated to add more used // - If a coordinating list property has too few values specified, its value list is repeated to add more used
// values. // values.
// - The computed values of the coordinating list properties are not affected by such truncation or repetition. // - The computed values of the coordinating list properties are not affected by such truncation or repetition.
// FIXME: This is required because our animation-* properties are not yet parsed as lists.
// Once that is fixed, every value here will be a StyleValueList.
auto const get_property_value_as_list = [&](PropertyID property_id) {
auto const& value = property(property_id);
return value.is_value_list() ? value.as_value_list().values() : StyleValueVector { value };
};
HashMap<PropertyID, StyleValueVector> coordinated_value_list; HashMap<PropertyID, StyleValueVector> coordinated_value_list;
for (size_t i = 0; i < get_property_value_as_list(base_property_id).size(); i++) { for (size_t i = 0; i < property(base_property_id).as_value_list().size(); i++) {
for (auto property_id : property_ids) { for (auto property_id : property_ids) {
auto const& list = get_property_value_as_list(property_id); auto const& list = property(property_id).as_value_list().values();
coordinated_value_list.ensure(property_id).append(list[i % list.size()]); coordinated_value_list.ensure(property_id).append(list[i % list.size()]);
} }