diff --git a/src/components/main/layout/wrapper.rs b/src/components/main/layout/wrapper.rs index aa8600db82e..9a23c15fa4c 100644 --- a/src/components/main/layout/wrapper.rs +++ b/src/components/main/layout/wrapper.rs @@ -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> for LayoutNodeChildrenIterator<'a> { // // FIXME(pcwalton): Parallelism! Eventually this should just be nuked. pub struct LayoutTreeIterator<'a> { - nodes: ~[LayoutNode<'a>], + nodes: Vec>, index: uint, } impl<'a> LayoutTreeIterator<'a> { - fn new(nodes: ~[LayoutNode<'a>]) -> LayoutTreeIterator<'a> { + fn new(nodes: Vec>) -> LayoutTreeIterator<'a> { LayoutTreeIterator { nodes: nodes, index: 0, @@ -319,7 +319,7 @@ impl<'a> Iterator> 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> 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>, postorder: bool) { if !postorder { refs.push(cur.clone()); }