LibWeb: Promote animation-composition values to enum

This brings us in line with the other `animation-*` enum properties
(`animation-play-state` and `animation-fill-mode`)
This commit is contained in:
Callum Law 2025-10-26 17:39:01 +13:00 committed by Sam Atkins
parent 8854bb62c6
commit 18477b0d84
Notes: github-actions[bot] 2025-10-27 09:49:39 +00:00
5 changed files with 27 additions and 16 deletions

View file

@ -936,4 +936,18 @@ void KeyframeEffect::update_computed_properties(AnimationUpdateContext& context)
target->document().style_computer().collect_animation_into(abstract_element, *this, *computed_properties);
}
Bindings::CompositeOperation css_animation_composition_to_bindings_composite_operation(CSS::AnimationComposition composition)
{
switch (composition) {
case CSS::AnimationComposition::Accumulate:
return Bindings::CompositeOperation::Accumulate;
case CSS::AnimationComposition::Add:
return Bindings::CompositeOperation::Add;
case CSS::AnimationComposition::Replace:
return Bindings::CompositeOperation::Replace;
default:
VERIFY_NOT_REACHED();
}
}
}

View file

@ -25,6 +25,8 @@ struct KeyframeEffectOptions : public EffectTiming {
Optional<String> pseudo_element {};
};
Bindings::CompositeOperation css_animation_composition_to_bindings_composite_operation(CSS::AnimationComposition composition);
// https://www.w3.org/TR/web-animations-1/#dictdef-basepropertyindexedkeyframe
// Note: This is an intermediate structure used only when parsing Keyframes provided by the caller in a slightly
// different format. It is converted to BaseKeyframe, which is why it doesn't need to store the parsed properties