From f1d82cf82c9fcbfdf0e40363588fd4ca0f708a3a Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 14 Nov 2014 10:31:28 -0800 Subject: [PATCH] Add FrameTree::add_child This helper method simplifies a few lines. --- components/compositing/constellation.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 0024d516f43..6e2d1380aa9 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -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 Constellation { 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 Constellation { 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)); } } }