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: [PATCH] script_trask, handle_msgs: factored out handle_msg_from_devtools --- components/script/script_task.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 2ec6699a60ee..a692a0e481c3 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,