script_trask, handle_msgs: factored out handle_msg_from_devtools

This commit is contained in:
Gilbert Röhrbein 2014-12-04 13:42:18 +01:00 committed by Ms2ger
parent 1fc46471ff
commit 31e40038cd

View file

@ -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,