mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
script: Unify LoadComplete and DOMLoad messages.
See the PR in which this commit landed and also https://github.com/servo/servo/pull/6415#issuecomment-122294169
This commit is contained in:
parent
572b3c31bd
commit
36376461f4
3 changed files with 10 additions and 25 deletions
|
@ -828,11 +828,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
debug!("constellation got load complete message");
|
||||
self.handle_load_complete_msg(pipeline_id)
|
||||
}
|
||||
// The DOM load event fired on a document
|
||||
FromScriptMsg::DOMLoad(pipeline_id) => {
|
||||
debug!("constellation got dom load message");
|
||||
self.handle_dom_load(pipeline_id)
|
||||
}
|
||||
// Handle a forward or back request
|
||||
FromScriptMsg::TraverseHistory(pipeline_id, direction) => {
|
||||
debug!("constellation got traverse history message from script");
|
||||
|
@ -1438,16 +1433,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
|
||||
fn handle_load_complete_msg(&mut self, pipeline_id: PipelineId) {
|
||||
if let Some(frame_id) = self.get_top_level_frame_for_pipeline(Some(pipeline_id)) {
|
||||
let forward = !self.joint_session_future(frame_id).is_empty();
|
||||
let back = !self.joint_session_past(frame_id).is_empty();
|
||||
let root = self.root_frame_id.is_none() || self.root_frame_id == Some(frame_id);
|
||||
self.compositor_proxy.send(ToCompositorMsg::LoadComplete(back, forward, root));
|
||||
}
|
||||
self.handle_subframe_loaded(pipeline_id);
|
||||
}
|
||||
|
||||
fn handle_dom_load(&mut self, pipeline_id: PipelineId) {
|
||||
let mut webdriver_reset = false;
|
||||
if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel {
|
||||
debug!("Sending load to WebDriver");
|
||||
|
@ -1459,6 +1444,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
if webdriver_reset {
|
||||
self.webdriver.load_channel = None;
|
||||
}
|
||||
if let Some(frame_id) = self.get_top_level_frame_for_pipeline(Some(pipeline_id)) {
|
||||
let forward = !self.joint_session_future(frame_id).is_empty();
|
||||
let back = !self.joint_session_past(frame_id).is_empty();
|
||||
let root = self.root_frame_id.is_none() || self.root_frame_id == Some(frame_id);
|
||||
self.compositor_proxy.send(ToCompositorMsg::LoadComplete(back, forward, root));
|
||||
}
|
||||
self.handle_subframe_loaded(pipeline_id);
|
||||
}
|
||||
|
||||
fn handle_traverse_history_msg(&mut self,
|
||||
|
|
|
@ -1497,14 +1497,10 @@ impl Document {
|
|||
let window = self.window();
|
||||
window.dom_manipulation_task_source().queue_event(self.upcast(), atom!("DOMContentLoaded"),
|
||||
EventBubbles::Bubbles, EventCancelable::NotCancelable, window);
|
||||
|
||||
window.reflow(ReflowGoal::ForDisplay,
|
||||
ReflowQueryType::NoQuery,
|
||||
ReflowReason::DOMContentLoaded);
|
||||
|
||||
let pipeline_id = self.window.pipeline();
|
||||
let event = ConstellationMsg::DOMLoad(pipeline_id);
|
||||
self.window.constellation_chan().send(event).unwrap();
|
||||
|
||||
update_with_current_time_ms(&self.dom_content_loaded_event_end);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,10 +70,6 @@ pub enum ScriptMsg {
|
|||
CreateWebGLPaintThread(Size2D<i32>,
|
||||
GLContextAttributes,
|
||||
IpcSender<Result<(IpcSender<CanvasMsg>, GLLimits), String>>),
|
||||
/// Dispatched after the DOM load event has fired on a document
|
||||
/// Causes a `load` event to be dispatched to any enclosing frame context element
|
||||
/// for the given pipeline.
|
||||
DOMLoad(PipelineId),
|
||||
/// Notifies the constellation that this frame has received focus.
|
||||
Focus(PipelineId),
|
||||
/// Re-send a mouse button event that was sent to the parent window.
|
||||
|
@ -84,7 +80,8 @@ pub enum ScriptMsg {
|
|||
GetClipboardContents(IpcSender<String>),
|
||||
/// <head> tag finished parsing
|
||||
HeadParsed,
|
||||
/// All pending loads are complete.
|
||||
/// All pending loads are complete, and the `load` event for this pipeline
|
||||
/// has been dispatched.
|
||||
LoadComplete(PipelineId),
|
||||
/// A new load has been requested.
|
||||
LoadUrl(PipelineId, LoadData),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue