LibWeb: Always parse comma separated value lists as StyleValueList

Previously we would either parse these as `StyleValueList<T>` or `T`
depending on whether or not there was more than one value, this meant we
always had to handle both cases anywhere we used these values.
This commit is contained in:
Callum Law 2025-11-29 14:30:45 +13:00 committed by Sam Atkins
parent 1a5933cb04
commit e937f5db57
Notes: github-actions[bot] 2025-12-01 10:19:04 +00:00
5 changed files with 19 additions and 20 deletions

View file

@ -17,6 +17,7 @@
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleInvalidation.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -609,11 +610,16 @@ Optional<double> AnimationEffect::transformed_progress() const
Optional<CSS::EasingFunction> AnimationEffect::parse_easing_string(StringView value)
{
if (auto style_value = parse_css_value(CSS::Parser::ParsingParams(), value, CSS::PropertyID::AnimationTimingFunction)) {
if (style_value->is_unresolved() || style_value->is_value_list() || style_value->is_css_wide_keyword())
if (style_value->is_unresolved() || style_value->is_css_wide_keyword())
return {};
// FIXME: We should absolutize style_value to resolve relative lengths within calcs
return CSS::EasingFunction::from_style_value(style_value.release_nonnull());
auto easing_values = style_value->as_value_list().values();
if (easing_values.size() != 1)
return {};
// FIXME: We should absolutize the style value to resolve relative lengths within calcs
return CSS::EasingFunction::from_style_value(easing_values[0]);
}
return {};