mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Animation: update image active frame when update the rendering (#36286)
When no CSS animation exist, register timer for image animation, update animated image active image frame as part of update_the_rendering, mark node as dirty if the corresponding image need update. Added unit test to test ImageAnimationState. Part of https://github.com/servo/servo/issues/36057, the last step to let the Animated Image "Move". Testing: Introduced new WPT RefTest for animated image, but fail because of https://github.com/servo/servo/issues/36931. New unit test for `ImageAnimationState`. Fixes: https://github.com/servo/servo/issues/22903 https://github.com/servo/servo/issues/36057 [Try](https://github.com/rayguo17/servo/actions/runs/14724729664) --------- Signed-off-by: rayguo17 <rayguo17@gmail.com>
This commit is contained in:
parent
2353c0089f
commit
23ce7b31ac
12 changed files with 313 additions and 8 deletions
|
@ -137,14 +137,23 @@ impl LayoutContext<'_> {
|
|||
if image_state.image_key() != image.id {
|
||||
if image.should_animate() {
|
||||
// i. Register/Replace tracking item in image_animation_manager.
|
||||
store.insert(node, ImageAnimationState::new(image));
|
||||
store.insert(
|
||||
node,
|
||||
ImageAnimationState::new(
|
||||
image,
|
||||
self.shared_context().current_time_for_animations,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// ii. Cancel Action if the node's image is no longer animated.
|
||||
store.remove(&node);
|
||||
}
|
||||
}
|
||||
} else if image.should_animate() {
|
||||
store.insert(node, ImageAnimationState::new(image));
|
||||
store.insert(
|
||||
node,
|
||||
ImageAnimationState::new(image, self.shared_context().current_time_for_animations),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue