mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Replace script thread root browsing context by a collection of documents.
This commit is contained in:
parent
ee588a31c3
commit
0d16a2a54e
9 changed files with 496 additions and 639 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue