mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Propagate 'auto' value of animation-duration
Avoids a crash when `animation-duration` was `auto`
This commit is contained in:
parent
c790de24dd
commit
826e947920
Notes:
github-actions[bot]
2025-11-28 13:26:48 +00:00
Author: https://github.com/Calme1709
Commit: 826e947920
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6912
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 29 additions and 1 deletions
|
|
@ -2287,7 +2287,27 @@ Vector<ComputedProperties::AnimationProperties> ComputedProperties::animations()
|
|||
auto animation_fill_mode_style_value = coordinated_properties.get(PropertyID::AnimationFillMode).value()[i];
|
||||
auto animation_composition_style_value = coordinated_properties.get(PropertyID::AnimationComposition).value()[i];
|
||||
|
||||
auto duration = Time::from_style_value(animation_duration_style_value, {}).to_milliseconds();
|
||||
// https://drafts.csswg.org/css-animations-2/#animation-duration
|
||||
auto duration = [&] -> Variant<double, String> {
|
||||
// auto
|
||||
if (animation_duration_style_value->to_keyword() == Keyword::Auto) {
|
||||
// For time-driven animations, equivalent to 0s.
|
||||
return 0;
|
||||
|
||||
// FIXME: For scroll-driven animations, equivalent to the duration necessary to fill the timeline in
|
||||
// consideration of animation-range, animation-delay, and animation-iteration-count. See
|
||||
// Scroll-driven Animations § 4.1 Finite Timeline Calculations.
|
||||
}
|
||||
|
||||
// <time [0s,∞]>
|
||||
|
||||
// FIXME: For scroll-driven animations, treated as auto.
|
||||
|
||||
// For time-driven animations, specifies the length of time that an animation takes to complete one cycle.
|
||||
// A negative <time> is invalid.
|
||||
return Time::from_style_value(animation_duration_style_value, {}).to_milliseconds();
|
||||
}();
|
||||
|
||||
auto timing_function = EasingFunction::from_style_value(animation_timing_function_style_value);
|
||||
|
||||
auto iteration_count = [&] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue