Get rid of match statements in layout queries in script_task

This commit is contained in:
lpy 2014-04-02 01:28:44 +08:00
parent ac5a634082
commit d4d6fcb5f0
2 changed files with 8 additions and 17 deletions

View file

@ -929,13 +929,10 @@ impl ScriptTask {
fn scroll_fragment_point(&self, pipeline_id: PipelineId, page: &Page, node: JS<Element>) {
let (port, chan) = Chan::new();
let node: JS<Node> = NodeCast::from(&node);
match page.query_layout(ContentBoxQuery(node.to_trusted_node_address(), chan), port) {
ContentBoxResponse(rect) => {
let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(),
to_frac_px(rect.origin.y).to_f32().unwrap());
self.compositor.scroll_fragment_point(pipeline_id, point);
}
}
let ContentBoxResponse(rect) = page.query_layout(ContentBoxQuery(node.to_trusted_node_address(), chan), port);
let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(),
to_frac_px(rect.origin.y).to_f32().unwrap());
self.compositor.scroll_fragment_point(pipeline_id, point);
}
/// This is the main entry point for receiving and dispatching DOM events.