Replace script thread root browsing context by a collection of documents.

This commit is contained in:
Alan Jeffrey 2016-10-07 15:52:49 -05:00
parent dae007fd16
commit 90e9c910f4
8 changed files with 494 additions and 668 deletions

View file

@ -97,6 +97,13 @@ impl NodeList {
panic!("called as_simple_list() on a children node list")
}
}
pub fn iter(&self) -> NodeListIterator {
NodeListIterator {
nodes: self,
offset: 0,
}
}
}
#[derive(JSTraceable, HeapSizeOf)]
@ -277,3 +284,18 @@ impl ChildrenList {
self.last_index.set(0u32);
}
}
pub struct NodeListIterator<'a> {
nodes: &'a NodeList,
offset: u32,
}
impl<'a> Iterator for NodeListIterator<'a> {
type Item = Root<Node>;
fn next(&mut self) -> Option<Root<Node>> {
let result = self.nodes.Item(self.offset);
self.offset = self.offset + 1;
result
}
}