mirror of
https://github.com/servo/servo.git
synced 2025-07-06 15:03:40 +01:00
script: Properly root nodes with animating images (#37689)
This change fixes an issue and makes a few more minor improvements to the `ImageAnimationState`: 1. Image rooting and unrooted now happens in one step from `Window::update_animations_post_reflow`. 2. The `node_to_animating_image_map` is now stored as a shared `RwLock` so that it doesn't need to be taken and then replaced in the `ImageAnimationState` during reflow. This should prevent a hypothetical issue where image animations are restarted during empty reflows. 3. General naming and idiomatic Rust usage improvements. Testing: This doesn't really have any obvious behavioral changes, because all reflows currently trigger a restyle. It becomes a serious problem with #37677 and this change fixes the failing test there. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
b89a44c539
commit
a66a257b38
10 changed files with 107 additions and 118 deletions
|
@ -31,6 +31,7 @@ use libc::c_void;
|
|||
use malloc_size_of::{MallocSizeOf as MallocSizeOfTrait, MallocSizeOfOps};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use net_traits::image_cache::{ImageCache, PendingImageId};
|
||||
use parking_lot::RwLock;
|
||||
use pixels::RasterImage;
|
||||
use profile_traits::mem::Report;
|
||||
use profile_traits::time;
|
||||
|
@ -412,8 +413,6 @@ pub struct ReflowResult {
|
|||
/// to communicate them with the Constellation and also the `Window`
|
||||
/// element of their content pages.
|
||||
pub iframe_sizes: IFrameSizes,
|
||||
/// The mapping of node to animated image, need to be returned to ImageAnimationManager
|
||||
pub node_to_image_animation_map: FxHashMap<OpaqueNode, ImageAnimationState>,
|
||||
}
|
||||
|
||||
/// Information needed for a script-initiated reflow.
|
||||
|
@ -440,7 +439,7 @@ pub struct ReflowRequest {
|
|||
/// The set of animations for this document.
|
||||
pub animations: DocumentAnimationSet,
|
||||
/// The set of image animations.
|
||||
pub node_to_image_animation_map: FxHashMap<OpaqueNode, ImageAnimationState>,
|
||||
pub node_to_animating_image_map: Arc<RwLock<FxHashMap<OpaqueNode, ImageAnimationState>>>,
|
||||
/// The theme for the window
|
||||
pub theme: Theme,
|
||||
/// The node highlighted by the devtools, if any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue