LibWeb/CSS: Allow non-StyleValueLists in animation properties

Reverts 51f694c6af and
b52beb5105.

The animation-* properties are in an awkward place currently, where
they *should* be lists, and a lot of our code acts as if they are, but
actually we parse them as single values. The above commits caused a few
WPT tests to crash - see link below. I've imported one of them to
prevent future regressions.
https://wpt.fyi/results/css/css-typed-om/the-stylepropertymap/properties?diff&filter=ADC&run_id=6293362870321152&run_id=5123272984494080
This commit is contained in:
Sam Atkins 2025-12-01 15:20:15 +00:00
parent 4d27e9aa5e
commit d9abfdf2ab
Notes: github-actions[bot] 2025-12-02 09:49:39 +00:00
4 changed files with 83 additions and 6 deletions

View file

@ -378,11 +378,20 @@ 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
// values.
// - 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;
for (size_t i = 0; i < property(base_property_id).as_value_list().size(); i++) {
for (size_t i = 0; i < get_property_value_as_list(base_property_id).size(); i++) {
for (auto property_id : property_ids) {
auto const& list = property(property_id).as_value_list().values();
auto const& list = get_property_value_as_list(property_id);
coordinated_value_list.ensure(property_id).append(list[i % list.size()]);
}

View file

@ -2807,12 +2807,18 @@ static CSSPixels snap_a_length_as_a_border_width(double device_pixels_per_css_pi
static NonnullRefPtr<StyleValue const> compute_style_value_list(NonnullRefPtr<StyleValue const> const& style_value, Function<NonnullRefPtr<StyleValue const>(NonnullRefPtr<StyleValue const> const&)> const& compute_entry)
{
StyleValueVector computed_entries;
// 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.
if (style_value->is_value_list()) {
StyleValueVector computed_entries;
for (auto const& entry : style_value->as_value_list().values())
computed_entries.append(compute_entry(entry));
for (auto const& entry : style_value->as_value_list().values())
computed_entries.append(compute_entry(entry));
return StyleValueList::create(move(computed_entries), StyleValueList::Separator::Comma);
return StyleValueList::create(move(computed_entries), StyleValueList::Separator::Comma);
}
return compute_entry(style_value);
}
NonnullRefPtr<StyleValue const> StyleComputer::compute_value_of_property(