Skip to content

Commit

Permalink
Get rid of match statements in Layout queries.(fixes #2019)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpy committed Apr 1, 2014
1 parent 3eac313 commit ac5a634
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions src/components/script/dom/element.rs
Expand Up @@ -571,19 +571,15 @@ impl Element {
let node: JS<Node> = NodeCast::from(abstract_self);
let (port, chan) = Chan::new();
let addr = node.to_trusted_node_address();
let rects =
match win.get().page().query_layout(ContentBoxesQuery(addr, chan), port) {
ContentBoxesResponse(rects) => {
rects.map(|r| {
ClientRect::new(
win,
r.origin.y,
r.origin.y + r.size.height,
r.origin.x,
r.origin.x + r.size.width)
})
},
};
let ContentBoxesResponse(rects) = win.get().page().query_layout(ContentBoxesQuery(addr, chan), port);
let rects = rects.map(|r| {
ClientRect::new(
win,
r.origin.y,
r.origin.y + r.size.height,
r.origin.x,
r.origin.x + r.size.width)
});

ClientRectList::new(win, rects)
}
Expand All @@ -595,16 +591,13 @@ impl Element {
let node: JS<Node> = NodeCast::from(abstract_self);
let (port, chan) = Chan::new();
let addr = node.to_trusted_node_address();
match win.get().page().query_layout(ContentBoxQuery(addr, chan), port) {
ContentBoxResponse(rect) => {
ClientRect::new(
win,
rect.origin.y,
rect.origin.y + rect.size.height,
rect.origin.x,
rect.origin.x + rect.size.width)
}
}
let ContentBoxResponse(rect) = win.get().page().query_layout(ContentBoxQuery(addr, chan), port);
ClientRect::new(
win,
rect.origin.y,
rect.origin.y + rect.size.height,
rect.origin.x,
rect.origin.x + rect.size.width)
}

pub fn GetInnerHTML(&self, abstract_self: &JS<Element>) -> Fallible<DOMString> {
Expand Down

0 comments on commit ac5a634

Please sign in to comment.