mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
~[] to Vec in main/layout/wrapper.rs
This commit is contained in:
parent
3a8ecb2bb1
commit
60d443da16
1 changed files with 5 additions and 5 deletions
|
@ -204,7 +204,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
///
|
||||
/// FIXME(pcwalton): Terribly inefficient. We should use parallelism.
|
||||
pub fn traverse_preorder(&self) -> LayoutTreeIterator<'ln> {
|
||||
let mut nodes = ~[];
|
||||
let mut nodes = Vec::new();
|
||||
gather_layout_nodes(self, &mut nodes, false);
|
||||
LayoutTreeIterator::new(nodes)
|
||||
}
|
||||
|
@ -301,12 +301,12 @@ impl<'a> Iterator<LayoutNode<'a>> for LayoutNodeChildrenIterator<'a> {
|
|||
//
|
||||
// FIXME(pcwalton): Parallelism! Eventually this should just be nuked.
|
||||
pub struct LayoutTreeIterator<'a> {
|
||||
nodes: ~[LayoutNode<'a>],
|
||||
nodes: Vec<LayoutNode<'a>>,
|
||||
index: uint,
|
||||
}
|
||||
|
||||
impl<'a> LayoutTreeIterator<'a> {
|
||||
fn new(nodes: ~[LayoutNode<'a>]) -> LayoutTreeIterator<'a> {
|
||||
fn new(nodes: Vec<LayoutNode<'a>>) -> LayoutTreeIterator<'a> {
|
||||
LayoutTreeIterator {
|
||||
nodes: nodes,
|
||||
index: 0,
|
||||
|
@ -319,7 +319,7 @@ impl<'a> Iterator<LayoutNode<'a>> for LayoutTreeIterator<'a> {
|
|||
if self.index >= self.nodes.len() {
|
||||
None
|
||||
} else {
|
||||
let v = self.nodes[self.index].clone();
|
||||
let v = self.nodes.get(self.index).clone();
|
||||
self.index += 1;
|
||||
Some(v)
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ impl<'a> Iterator<LayoutNode<'a>> for LayoutTreeIterator<'a> {
|
|||
}
|
||||
|
||||
/// FIXME(pcwalton): This is super inefficient.
|
||||
fn gather_layout_nodes<'a>(cur: &LayoutNode<'a>, refs: &mut ~[LayoutNode<'a>], postorder: bool) {
|
||||
fn gather_layout_nodes<'a>(cur: &LayoutNode<'a>, refs: &mut Vec<LayoutNode<'a>>, postorder: bool) {
|
||||
if !postorder {
|
||||
refs.push(cur.clone());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue