mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Cleanup Page::remove.
This commit is contained in:
parent
d8a5199ba8
commit
6fa39497b8
1 changed files with 7 additions and 15 deletions
|
@ -228,26 +228,18 @@ impl Page {
|
||||||
self.children
|
self.children
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.enumerate()
|
.position(|page_tree| page_tree.id == id)
|
||||||
.find(|&(_idx, ref page_tree)| {
|
|
||||||
// FIXME: page_tree has a lifetime such that it's unusable for anything.
|
|
||||||
let page_tree_id = page_tree.id;
|
|
||||||
page_tree_id == id
|
|
||||||
})
|
|
||||||
.map(|(idx, _)| idx)
|
|
||||||
};
|
};
|
||||||
match remove_idx {
|
match remove_idx {
|
||||||
Some(idx) => return Some(self.children.borrow_mut().remove(idx).unwrap()),
|
Some(idx) => Some(self.children.borrow_mut().remove(idx).unwrap()),
|
||||||
None => {
|
None => {
|
||||||
for page_tree in self.children.borrow_mut().iter_mut() {
|
self.children
|
||||||
match page_tree.remove(id) {
|
.borrow_mut()
|
||||||
found @ Some(_) => return found,
|
.iter_mut()
|
||||||
None => (), // keep going...
|
.filter_map(|page_tree| page_tree.remove(id))
|
||||||
}
|
.next()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_page_clip_rect_with_new_viewport(&self, viewport: Rect<f32>) -> bool {
|
pub fn set_page_clip_rect_with_new_viewport(&self, viewport: Rect<f32>) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue