Get rid of match statements in Layout queries.(fixes #2019)

This commit is contained in:
lpy 2014-04-02 00:55:33 +08:00
parent 3eac31394c
commit ac5a634082

View file

@ -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| {
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)
}
@ -595,8 +591,7 @@ 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) => {
let ContentBoxResponse(rect) = win.get().page().query_layout(ContentBoxQuery(addr, chan), port);
ClientRect::new(
win,
rect.origin.y,
@ -604,8 +599,6 @@ impl Element {
rect.origin.x,
rect.origin.x + rect.size.width)
}
}
}
pub fn GetInnerHTML(&self, abstract_self: &JS<Element>) -> Fallible<DOMString> {
//XXX TODO: XML case