mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Root nodes for the duration of their CSS transitions.
This ensures that we can pass a node address as part of the asynchronous transition end notification, making it safe to fire the corresponding DOM event on the node from the script thread. Without explicitly rooting this node when the transition starts, we risk the node being GCed before the transition is complete.
This commit is contained in:
parent
f3c8f7e0d0
commit
dabebdfbf5
11 changed files with 126 additions and 25 deletions
|
@ -94,6 +94,9 @@ pub struct LayoutThreadData {
|
|||
|
||||
/// A queued response for the list of nodes at a given point.
|
||||
pub nodes_from_point_response: Vec<UntrustedNodeAddress>,
|
||||
|
||||
/// A list of nodes that have just started a CSS transition.
|
||||
pub newly_transitioning_nodes: Vec<UntrustedNodeAddress>,
|
||||
}
|
||||
|
||||
pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>);
|
||||
|
@ -204,6 +207,12 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
let mut rw_data = rw_data.lock().unwrap();
|
||||
mem::replace(&mut rw_data.pending_images, vec![])
|
||||
}
|
||||
|
||||
fn newly_transitioning_nodes(&self) -> Vec<UntrustedNodeAddress> {
|
||||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let mut rw_data = rw_data.lock().unwrap();
|
||||
mem::replace(&mut rw_data.newly_transitioning_nodes, vec![])
|
||||
}
|
||||
}
|
||||
|
||||
struct UnioningFragmentBorderBoxIterator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue