mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
auto merge of #4315 : Ms2ger/servo/page, r=jdm
This commit is contained in:
commit
315e166cf7
1 changed files with 15 additions and 25 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 {
|
||||||
|
@ -278,14 +270,14 @@ impl Page {
|
||||||
|
|
||||||
impl Iterator<Rc<Page>> for PageIterator {
|
impl Iterator<Rc<Page>> for PageIterator {
|
||||||
fn next(&mut self) -> Option<Rc<Page>> {
|
fn next(&mut self) -> Option<Rc<Page>> {
|
||||||
if !self.stack.is_empty() {
|
match self.stack.pop() {
|
||||||
let next = self.stack.pop().unwrap();
|
Some(next) => {
|
||||||
for child in next.children.borrow().iter() {
|
for child in next.children.borrow().iter() {
|
||||||
self.stack.push(child.clone());
|
self.stack.push(child.clone());
|
||||||
}
|
}
|
||||||
Some(next.clone())
|
Some(next)
|
||||||
} else {
|
},
|
||||||
None
|
None => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,8 +353,6 @@ impl Page {
|
||||||
/// won't wait for the new layout computation to finish.
|
/// won't wait for the new layout computation to finish.
|
||||||
///
|
///
|
||||||
/// If there is no window size yet, the page is presumed invisible and no reflow is performed.
|
/// If there is no window size yet, the page is presumed invisible and no reflow is performed.
|
||||||
///
|
|
||||||
/// This function fails if there is no root frame.
|
|
||||||
pub fn reflow(&self,
|
pub fn reflow(&self,
|
||||||
goal: ReflowGoal,
|
goal: ReflowGoal,
|
||||||
script_chan: ScriptControlChan,
|
script_chan: ScriptControlChan,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue