Add FrameTree::add_child

This helper method simplifies a few lines.
This commit is contained in:
Martin Robinson 2014-11-14 10:31:28 -08:00
parent 6a46eef5cd
commit f1d82cf82c

View file

@ -118,6 +118,10 @@ impl FrameTree {
has_compositor_layer: Cell::new(false),
}
}
fn add_child(&self, new_child: ChildFrameTree) {
self.children.borrow_mut().push(new_child);
}
}
#[deriving(Clone)]
@ -720,8 +724,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let new_frame_tree =
Rc::new(FrameTree::new(self.get_next_frame_id(), new_pipeline,
Some(frame_tree.pipeline.borrow().clone())));
frame_tree.children.borrow_mut().push(ChildFrameTree::new(new_frame_tree,
new_rect));
frame_tree.add_child(ChildFrameTree::new(new_frame_tree, new_rect));
}
}
}
@ -963,8 +966,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let parent = next_frame_tree.find(parent.id).expect(
"Constellation: pending frame has a parent frame that is not
active. This is a bug.");
parent.children.borrow_mut().push(ChildFrameTree::new(to_add.clone(),
rect));
parent.add_child(ChildFrameTree::new(to_add.clone(), rect));
}
}
}