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:
Josh Matthews 2017-04-07 06:57:08 +09:00
parent f3c8f7e0d0
commit dabebdfbf5
11 changed files with 126 additions and 25 deletions

View file

@ -76,7 +76,7 @@ use script_layout_interface::rpc::{MarginStyleResponse, NodeScrollRootIdResponse
use script_layout_interface::rpc::{ResolvedStyleResponse, TextIndexResponse};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory};
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper};
use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg};
use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg, ScriptThread};
use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress};
use script_traits::{DocumentState, TimerEvent, TimerEventId};
use script_traits::{ScriptMsg as ConstellationMsg, TimerSchedulerMsg, WindowSizeData, WindowSizeType};
@ -1150,6 +1150,7 @@ impl Window {
/// off-main-thread layout.
///
/// Returns true if layout actually happened, false otherwise.
#[allow(unsafe_code)]
pub fn force_reflow(&self,
goal: ReflowGoal,
query_type: ReflowQueryType,
@ -1261,6 +1262,9 @@ impl Window {
}
}
let newly_transitioning_nodes = self.layout_rpc.newly_transitioning_nodes();
ScriptThread::note_newly_transitioning_nodes(newly_transitioning_nodes);
true
}