diff options
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r-- | components/script/devtools.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 2211df2931b..06a2141d3b1 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -4,7 +4,7 @@ use devtools_traits::{CachedConsoleMessage, CachedConsoleMessageTypes, PAGE_ERROR, CONSOLE_API}; use devtools_traits::{EvaluateJSReply, NodeInfo, Modification, TimelineMarker, TimelineMarkerType}; -use devtools_traits::{ConsoleAPI, PageError}; +use devtools_traits::{ConsoleAPI, PageError, ScriptToDevtoolsControlMsg, ComputedNodeLayout}; use dom::bindings::conversions::jsstring_to_str; use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::js::Root; @@ -97,13 +97,16 @@ pub fn handle_get_children(page: &Rc<Page>, pipeline: PipelineId, node_id: Strin reply.send(children).unwrap(); } -pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String, reply: IpcSender<(f32, f32)>) { +pub fn handle_get_layout(page: &Rc<Page>, + pipeline: PipelineId, + node_id: String, + reply: IpcSender<ComputedNodeLayout>) { let node = find_node_by_unique_id(&*page, pipeline, node_id); let elem = ElementCast::to_ref(node.r()).expect("should be getting layout of element"); let rect = elem.GetBoundingClientRect(); let width = *rect.r().Width(); let height = *rect.r().Height(); - reply.send((width, height)).unwrap(); + reply.send(ComputedNodeLayout { width: width, height: height }).unwrap(); } pub fn handle_get_cached_messages(_pipeline_id: PipelineId, @@ -202,10 +205,12 @@ pub fn handle_drop_timeline_markers(page: &Rc<Page>, } } -pub fn handle_request_animation_frame(page: &Rc<Page>, id: PipelineId, callback: IpcSender<f64>) { +pub fn handle_request_animation_frame(page: &Rc<Page>, id: PipelineId, actor_name: String) { let page = page.find(id).expect("There is no such page"); let doc = page.document(); + let devtools_sender = page.window().devtools_chan().unwrap(); doc.r().request_animation_frame(box move |time| { - callback.send(time).unwrap() + let msg = ScriptToDevtoolsControlMsg::FramerateTick(actor_name, time); + devtools_sender.send(msg).unwrap(); }); } |