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: [PATCH] script_trask, handle_msgs: factored out handle_msg_from_constellation --- components/script/script_task.rs | 37 +++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) 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,