diff options
author | lpy <pylaurent1314@gmail.com> | 2014-04-02 00:55:33 +0800 |
---|---|---|
committer | lpy <pylaurent1314@gmail.com> | 2014-04-02 00:55:33 +0800 |
commit | ac5a634082fa3871a849f171e671d86efc30d074 (patch) | |
tree | 323c2739aad664edaafbdf45a7c9f8459868ea96 /src | |
parent | 3eac31394cb509ce7e4fa61a3543f6ec22c8bde4 (diff) | |
download | servo-ac5a634082fa3871a849f171e671d86efc30d074.tar.gz servo-ac5a634082fa3871a849f171e671d86efc30d074.zip |
Get rid of match statements in Layout queries.(fixes #2019)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/element.rs | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index c7676a3a616..aa092bce325 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -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) } @@ -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> { |