Accumulate transitioning nodes inside the layout context.

This commit is contained in:
Josh Matthews 2017-04-10 17:02:25 +10:00
parent dabebdfbf5
commit c3b9714ab7
3 changed files with 40 additions and 17 deletions

View file

@ -26,7 +26,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
script_chan: &IpcSender<ConstellationControlMsg>,
running_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
expired_animations: &mut HashMap<OpaqueNode, Vec<Animation>>,
newly_transitioning_nodes: &mut Vec<UntrustedNodeAddress>,
mut newly_transitioning_nodes: Option<&mut Vec<UntrustedNodeAddress>>,
new_animations_receiver: &Receiver<Animation>,
pipeline_id: PipelineId,
timer: &Timer) {
@ -115,8 +115,11 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
// Add new running animations.
for new_running_animation in new_running_animations {
if new_running_animation.is_transition() {
newly_transitioning_nodes.push(new_running_animation.node().to_untrusted_node_address());
match newly_transitioning_nodes {
Some(ref mut nodes) if new_running_animation.is_transition() => {
nodes.push(new_running_animation.node().to_untrusted_node_address());
}
_ => ()
}
running_animations.entry(*new_running_animation.node())

View file

@ -15,6 +15,7 @@ use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
use opaque_node::OpaqueNodeMethods;
use parking_lot::RwLock;
use script_layout_interface::{PendingImage, PendingImageState};
use script_traits::UntrustedNodeAddress;
use servo_url::ServoUrl;
use std::borrow::{Borrow, BorrowMut};
use std::cell::{RefCell, RefMut};
@ -96,7 +97,11 @@ pub struct LayoutContext<'a> {
/// A list of in-progress image loads to be shared with the script thread.
/// A None value means that this layout was not initiated by the script thread.
pub pending_images: Option<Mutex<Vec<PendingImage>>>
pub pending_images: Option<Mutex<Vec<PendingImage>>>,
/// A list of nodes that have just initiated a CSS transition.
/// A None value means that this layout was not initiated by the script thread.
pub newly_transitioning_nodes: Option<Mutex<Vec<UntrustedNodeAddress>>>,
}
impl<'a> Drop for LayoutContext<'a> {