mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Replace script thread root browsing context by a collection of documents.
This commit is contained in:
parent
dae007fd16
commit
90e9c910f4
8 changed files with 494 additions and 668 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