mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Get rid of match statements in Layout queries.(fixes #2019)
This commit is contained in:
parent
3eac31394c
commit
ac5a634082
1 changed files with 16 additions and 23 deletions
|
@ -571,19 +571,15 @@ impl Element {
|
||||||
let node: JS<Node> = NodeCast::from(abstract_self);
|
let node: JS<Node> = NodeCast::from(abstract_self);
|
||||||
let (port, chan) = Chan::new();
|
let (port, chan) = Chan::new();
|
||||||
let addr = node.to_trusted_node_address();
|
let addr = node.to_trusted_node_address();
|
||||||
let rects =
|
let ContentBoxesResponse(rects) = win.get().page().query_layout(ContentBoxesQuery(addr, chan), port);
|
||||||
match win.get().page().query_layout(ContentBoxesQuery(addr, chan), port) {
|
let rects = rects.map(|r| {
|
||||||
ContentBoxesResponse(rects) => {
|
ClientRect::new(
|
||||||
rects.map(|r| {
|
win,
|
||||||
ClientRect::new(
|
r.origin.y,
|
||||||
win,
|
r.origin.y + r.size.height,
|
||||||
r.origin.y,
|
r.origin.x,
|
||||||
r.origin.y + r.size.height,
|
r.origin.x + r.size.width)
|
||||||
r.origin.x,
|
});
|
||||||
r.origin.x + r.size.width)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
ClientRectList::new(win, rects)
|
ClientRectList::new(win, rects)
|
||||||
}
|
}
|
||||||
|
@ -595,16 +591,13 @@ impl Element {
|
||||||
let node: JS<Node> = NodeCast::from(abstract_self);
|
let node: JS<Node> = NodeCast::from(abstract_self);
|
||||||
let (port, chan) = Chan::new();
|
let (port, chan) = Chan::new();
|
||||||
let addr = node.to_trusted_node_address();
|
let addr = node.to_trusted_node_address();
|
||||||
match win.get().page().query_layout(ContentBoxQuery(addr, chan), port) {
|
let ContentBoxResponse(rect) = win.get().page().query_layout(ContentBoxQuery(addr, chan), port);
|
||||||
ContentBoxResponse(rect) => {
|
ClientRect::new(
|
||||||
ClientRect::new(
|
win,
|
||||||
win,
|
rect.origin.y,
|
||||||
rect.origin.y,
|
rect.origin.y + rect.size.height,
|
||||||
rect.origin.y + rect.size.height,
|
rect.origin.x,
|
||||||
rect.origin.x,
|
rect.origin.x + rect.size.width)
|
||||||
rect.origin.x + rect.size.width)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn GetInnerHTML(&self, abstract_self: &JS<Element>) -> Fallible<DOMString> {
|
pub fn GetInnerHTML(&self, abstract_self: &JS<Element>) -> Fallible<DOMString> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue