aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/animation.rs20
-rw-r--r--components/layout/context.rs7
-rw-r--r--components/layout/query.rs11
3 files changed, 23 insertions, 15 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index be6d5baf77c..d1673ac44a1 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -9,7 +9,9 @@ use flow::{self, Flow};
use gfx::display_list::OpaqueNode;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
+use opaque_node::OpaqueNodeMethods;
use script_traits::{AnimationState, ConstellationControlMsg, LayoutMsg as ConstellationMsg};
+use script_traits::UntrustedNodeAddress;
use std::collections::HashMap;
use std::sync::mpsc::Receiver;
use style::animation::{Animation, update_style_for_animation};
@@ -24,6 +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>>,
+ mut newly_transitioning_nodes: Option<&mut Vec<UntrustedNodeAddress>>,
new_animations_receiver: &Receiver<Animation>,
pipeline_id: PipelineId,
timer: &Timer) {
@@ -71,7 +74,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
let mut animations_still_running = vec![];
for mut running_animation in running_animations.drain(..) {
let still_running = !running_animation.is_expired() && match running_animation {
- Animation::Transition(_, _, started_at, ref frame, _expired) => {
+ Animation::Transition(_, started_at, ref frame, _expired) => {
now < started_at + frame.duration
}
Animation::Keyframes(_, _, ref mut state) => {
@@ -86,8 +89,8 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
continue
}
- if let Animation::Transition(_, unsafe_node, _, ref frame, _) = running_animation {
- script_chan.send(ConstellationControlMsg::TransitionEnd(unsafe_node,
+ if let Animation::Transition(node, _, ref frame, _) = running_animation {
+ script_chan.send(ConstellationControlMsg::TransitionEnd(node.to_untrusted_node_address(),
frame.property_animation
.property_name().into(),
frame.duration))
@@ -112,6 +115,17 @@ 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() {
+ match newly_transitioning_nodes {
+ Some(ref mut nodes) => {
+ nodes.push(new_running_animation.node().to_untrusted_node_address());
+ }
+ None => {
+ warn!("New transition encountered from compositor-initiated layout.");
+ }
+ }
+ }
+
running_animations.entry(*new_running_animation.node())
.or_insert_with(Vec::new)
.push(new_running_animation)
diff --git a/components/layout/context.rs b/components/layout/context.rs
index 214061e276f..8acbc3b254a 100644
--- a/components/layout/context.rs
+++ b/components/layout/context.rs
@@ -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> {
diff --git a/components/layout/query.rs b/components/layout/query.rs
index c12a2b7f63d..476a68afafe 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -17,7 +17,6 @@ use inline::LAST_FRAGMENT_OF_ELEMENT;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use opaque_node::OpaqueNodeMethods;
-use script_layout_interface::PendingImage;
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse};
use script_layout_interface::rpc::{HitTestResponse, LayoutRPC};
use script_layout_interface::rpc::{MarginStyleResponse, NodeGeometryResponse};
@@ -28,7 +27,6 @@ use script_traits::LayoutMsg as ConstellationMsg;
use script_traits::UntrustedNodeAddress;
use sequential;
use std::cmp::{min, max};
-use std::mem;
use std::ops::Deref;
use std::sync::{Arc, Mutex};
use style::computed_values;
@@ -89,9 +87,6 @@ pub struct LayoutThreadData {
/// Index in a text fragment. We need this do determine the insertion point.
pub text_index_response: TextIndexResponse,
- /// A list of images requests that need to be initiated.
- pub pending_images: Vec<PendingImage>,
-
/// A queued response for the list of nodes at a given point.
pub nodes_from_point_response: Vec<UntrustedNodeAddress>,
}
@@ -198,12 +193,6 @@ impl LayoutRPC for LayoutRPCImpl {
let rw_data = rw_data.lock().unwrap();
rw_data.text_index_response.clone()
}
-
- fn pending_images(&self) -> Vec<PendingImage> {
- let &LayoutRPCImpl(ref rw_data) = self;
- let mut rw_data = rw_data.lock().unwrap();
- mem::replace(&mut rw_data.pending_images, vec![])
- }
}
struct UnioningFragmentBorderBoxIterator {