mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
LibWeb: Pause keyframe animations during creation when necessary
This commit is contained in:
parent
2ee022dead
commit
b235620315
Notes:
sideshowbarker
2024-07-17 07:31:31 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/b235620315 Pull-request: https://github.com/SerenityOS/serenity/pull/23344 Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 12 additions and 0 deletions
|
@ -50,6 +50,10 @@
|
|||
"normal",
|
||||
"reverse"
|
||||
],
|
||||
"animation-play-state": [
|
||||
"paused",
|
||||
"running"
|
||||
],
|
||||
"appearance": [
|
||||
"auto",
|
||||
"button",
|
||||
|
|
|
@ -1059,6 +1059,12 @@ ErrorOr<void> StyleComputer::compute_cascaded_values(StyleProperties& style, DOM
|
|||
direction = *direction_value;
|
||||
}
|
||||
|
||||
CSS::AnimationPlayState play_state { CSS::AnimationPlayState::Running };
|
||||
if (auto play_state_property = style.maybe_null_property(PropertyID::AnimationPlayState); play_state_property && play_state_property->is_identifier()) {
|
||||
if (auto play_state_value = value_id_to_animation_play_state(play_state_property->to_identifier()); play_state_value.has_value())
|
||||
play_state = *play_state_value;
|
||||
}
|
||||
|
||||
Animations::TimingFunction timing_function = Animations::ease_timing_function;
|
||||
if (auto timing_property = style.maybe_null_property(PropertyID::AnimationTimingFunction); timing_property && timing_property->is_easing())
|
||||
timing_function = Animations::TimingFunction::from_easing_style_value(timing_property->as_easing());
|
||||
|
@ -1091,6 +1097,8 @@ ErrorOr<void> StyleComputer::compute_cascaded_values(StyleProperties& style, DOM
|
|||
|
||||
HTML::TemporaryExecutionContext context(m_document->relevant_settings_object());
|
||||
animation->play().release_value_but_fixme_should_propagate_errors();
|
||||
if (play_state == CSS::AnimationPlayState::Paused)
|
||||
animation->pause().release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue