From 9b9f6627325e45588897fc9e5396901d42799e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilbert=20R=C3=B6hrbein?= Date: Thu, 4 Dec 2014 13:28:34 +0100 Subject: script_task, handle_msgs: sort for pattern constructor --- components/script/script_task.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index dd29d9e31d3..bd30b6ab0f9 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -540,21 +540,19 @@ impl ScriptTask { // TODO(tkuehn) need to handle auxiliary layouts for iframes FromConstellation(AttachLayoutMsg(_)) => panic!("should have handled AttachLayoutMsg already"), FromConstellation(LoadMsg(id, load_data)) => self.load(id, load_data), - FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data), - FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url), FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event), - FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id), - FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"), - FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction), FromConstellation(ReflowCompleteMsg(id, reflow_id)) => self.handle_reflow_complete_msg(id, reflow_id), FromConstellation(ResizeInactiveMsg(id, new_size)) => self.handle_resize_inactive_msg(id, new_size), FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false }, FromConstellation(ViewportMsg(..)) => panic!("should have handled ViewportMsg already"), - FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id), FromConstellation(ResizeMsg(..)) => panic!("should have handled ResizeMsg already"), - FromConstellation(GetTitleMsg(pipeline_id)) => { - self.handle_get_title_msg(pipeline_id) - } + FromConstellation(GetTitleMsg(pipeline_id)) => self.handle_get_title_msg(pipeline_id) + FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data), + FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url), + FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id), + FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"), + FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction), + FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id), FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress), FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr), FromScript(DOMMessage(..)) => panic!("unexpected message"), -- cgit v1.2.3 From 8da73afa06a89369a7506f44dc12c93b74392344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilbert=20R=C3=B6hrbein?= Date: Thu, 4 Dec 2014 13:33:52 +0100 Subject: script_trask, handle_msgs: factored out handle_msg_from_constellation --- components/script/script_task.rs | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index bd30b6ab0f9..bd420f88048 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -537,16 +537,9 @@ impl ScriptTask { // Process the gathered events. for msg in sequential.into_iter() { match msg { - // TODO(tkuehn) need to handle auxiliary layouts for iframes - FromConstellation(AttachLayoutMsg(_)) => panic!("should have handled AttachLayoutMsg already"), - FromConstellation(LoadMsg(id, load_data)) => self.load(id, load_data), - FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event), - FromConstellation(ReflowCompleteMsg(id, reflow_id)) => self.handle_reflow_complete_msg(id, reflow_id), - FromConstellation(ResizeInactiveMsg(id, new_size)) => self.handle_resize_inactive_msg(id, new_size), - FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false }, - FromConstellation(ViewportMsg(..)) => panic!("should have handled ViewportMsg already"), - FromConstellation(ResizeMsg(..)) => panic!("should have handled ResizeMsg already"), - FromConstellation(GetTitleMsg(pipeline_id)) => self.handle_get_title_msg(pipeline_id) + FromConstellation(ExitPipelineMsg(id)) => + if self.handle_exit_pipeline_msg(id) { return false }, + FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg), FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data), FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url), FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id), @@ -575,6 +568,30 @@ impl ScriptTask { true } + fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) { + match msg { + // TODO(tkuehn) need to handle auxiliary layouts for iframes + AttachLayoutMsg(_) => + panic!("should have handled AttachLayoutMsg already"), + LoadMsg(id, load_data) => + self.load(id, load_data), + SendEventMsg(id, event) => + self.handle_event(id, event), + ReflowCompleteMsg(id, reflow_id) => + self.handle_reflow_complete_msg(id, reflow_id), + ResizeInactiveMsg(id, new_size) => + self.handle_resize_inactive_msg(id, new_size), + ViewportMsg(..) => + panic!("should have handled ViewportMsg already"), + ResizeMsg(..) => + panic!("should have handled ResizeMsg already"), + ExitPipelineMsg(..) => + panic!("should have handled ExitPipelineMsg already"), + GetTitleMsg(pipeline_id) => + self.handle_get_title_msg(pipeline_id), + } + } + fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) { let NewLayoutInfo { old_pipeline_id, -- cgit v1.2.3 From 1fc46471ffb35bb0457555c80604e7d2e637554b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilbert=20R=C3=B6hrbein?= Date: Thu, 4 Dec 2014 13:39:01 +0100 Subject: script_trask, handle_msgs: factored out handle_msg_from_script --- components/script/script_task.rs | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index bd420f88048..2ec6699a60e 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -540,17 +540,7 @@ impl ScriptTask { FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false }, FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg), - FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data), - FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url), - FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id), - FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"), - FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction), - FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id), - FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress), - FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr), - FromScript(DOMMessage(..)) => panic!("unexpected message"), - FromScript(WorkerPostMessage(addr, data, nbytes)) => Worker::handle_message(addr, data, nbytes), - FromScript(WorkerRelease(addr)) => Worker::handle_release(addr), + FromScript(inner_msg) => self.handle_msg_from_script(inner_msg), FromDevtools(EvaluateJS(id, s, reply)) => devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply), FromDevtools(GetRootNode(id, reply)) => devtools::handle_get_root_node(&*self.page.borrow(), id, reply), FromDevtools(GetDocumentElement(id, reply)) => devtools::handle_get_document_element(&*self.page.borrow(), id, reply), @@ -592,6 +582,33 @@ impl ScriptTask { } } + fn handle_msg_from_script(&self, msg: ScriptMsg) { + match msg { + TriggerLoadMsg(id, load_data) => + self.trigger_load(id, load_data), + TriggerFragmentMsg(id, url) => + self.trigger_fragment(id, url), + FireTimerMsg(FromWindow(id), timer_id) => + self.handle_fire_timer_msg(id, timer_id), + FireTimerMsg(FromWorker, _) => + panic!("Worker timeouts must not be sent to script task"), + NavigateMsg(direction) => + self.handle_navigate_msg(direction), + ExitWindowMsg(id) => + self.handle_exit_window_msg(id), + XHRProgressMsg(addr, progress) => + XMLHttpRequest::handle_progress(addr, progress), + XHRReleaseMsg(addr) => + XMLHttpRequest::handle_release(addr), + DOMMessage(..) => + panic!("unexpected message"), + WorkerPostMessage(addr, data, nbytes) => + Worker::handle_message(addr, data, nbytes), + WorkerRelease(addr) => + Worker::handle_release(addr), + } + } + fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) { let NewLayoutInfo { old_pipeline_id, -- cgit v1.2.3 From 31e40038cd4448592d660a1c2e4f823cf2d965dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilbert=20R=C3=B6hrbein?= Date: Thu, 4 Dec 2014 13:42:18 +0100 Subject: script_trask, handle_msgs: factored out handle_msg_from_devtools --- components/script/script_task.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 2ec6699a60e..a692a0e481c 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -541,12 +541,7 @@ impl ScriptTask { if self.handle_exit_pipeline_msg(id) { return false }, FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg), FromScript(inner_msg) => self.handle_msg_from_script(inner_msg), - FromDevtools(EvaluateJS(id, s, reply)) => devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply), - FromDevtools(GetRootNode(id, reply)) => devtools::handle_get_root_node(&*self.page.borrow(), id, reply), - FromDevtools(GetDocumentElement(id, reply)) => devtools::handle_get_document_element(&*self.page.borrow(), id, reply), - FromDevtools(GetChildren(id, node_id, reply)) => devtools::handle_get_children(&*self.page.borrow(), id, node_id, reply), - FromDevtools(GetLayout(id, node_id, reply)) => devtools::handle_get_layout(&*self.page.borrow(), id, node_id, reply), - FromDevtools(ModifyAttribute(id, node_id, modifications)) => devtools::handle_modify_attribute(&*self.page.borrow(), id, node_id, modifications), + FromDevtools(inner_msg) => self.handle_msg_from_devtools(inner_msg), } } @@ -609,6 +604,23 @@ impl ScriptTask { } } + fn handle_msg_from_devtools(&self, msg: DevtoolScriptControlMsg) { + match msg { + EvaluateJS(id, s, reply) => + devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply), + GetRootNode(id, reply) => + devtools::handle_get_root_node(&*self.page.borrow(), id, reply), + GetDocumentElement(id, reply) => + devtools::handle_get_document_element(&*self.page.borrow(), id, reply), + GetChildren(id, node_id, reply) => + devtools::handle_get_children(&*self.page.borrow(), id, node_id, reply), + GetLayout(id, node_id, reply) => + devtools::handle_get_layout(&*self.page.borrow(), id, node_id, reply), + ModifyAttribute(id, node_id, modifications) => + devtools::handle_modify_attribute(&*self.page.borrow(), id, node_id, modifications), + } + } + fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) { let NewLayoutInfo { old_pipeline_id, -- cgit v1.2.3