aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/page.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-11-12 00:24:19 -0500
committerCorey Farwell <coreyf@rwell.org>2015-11-12 00:24:19 -0500
commitbfc4ed4cac79192fd054ce9dd68a0bad13f854fb (patch)
treedeecb002247f5c4987bd2181a5702ea1a8b98ee5 /components/script/page.rs
parent1b20bc90ee8321aaa95e1906321753549ad166e6 (diff)
downloadservo-bfc4ed4cac79192fd054ce9dd68a0bad13f854fb.tar.gz
servo-bfc4ed4cac79192fd054ce9dd68a0bad13f854fb.zip
Cleanup PageIterator::next
Diffstat (limited to 'components/script/page.rs')
-rw-r--r--components/script/page.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/components/script/page.rs b/components/script/page.rs
index 67cb1ca46ed..cedbb02bd74 100644
--- a/components/script/page.rs
+++ b/components/script/page.rs
@@ -100,15 +100,11 @@ impl Iterator for PageIterator {
type Item = Rc<Page>;
fn next(&mut self) -> Option<Rc<Page>> {
- match self.stack.pop() {
- Some(next) => {
- for child in &*next.children.borrow() {
- self.stack.push(child.clone());
- }
- Some(next)
- },
- None => None,
+ let popped = self.stack.pop();
+ if let Some(ref page) = popped {
+ self.stack.extend(page.children.borrow().iter().cloned());
}
+ popped
}
}