Remove CompositorData::add_child

The contents of this method have dwindled to two statements. Just
remove the method now.
This commit is contained in:
Martin Robinson 2014-07-29 18:10:49 -07:00
parent d3c0d8d6f8
commit 9edaff4304
2 changed files with 13 additions and 17 deletions

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use compositor_data::{CompositorData, WantsScrollEvents};
use compositor_data::{CompositorData, DoesntWantScrollEvents, WantsScrollEvents};
use compositor_task::{Msg, CompositorTask, Exit, ChangeReadyState, SetIds, LayerProperties};
use compositor_task::{GetGraphicsMetadata, CreateOrUpdateRootLayer, CreateOrUpdateDescendantLayer};
use compositor_task::{SetLayerClipRect, Paint, ScrollFragmentPoint, LoadComplete};
@ -421,12 +421,15 @@ impl IOCompositor {
background_color: layer_properties.background_color,
scroll_policy: FixedPosition,
};
let new_root = CompositorData::new_layer(root_pipeline,
let new_root = CompositorData::new_layer(root_pipeline.clone(),
root_properties,
WantsScrollEvents,
self.opts.tile_size);
CompositorData::add_child(new_root.clone(), layer_properties);
let first_chid = CompositorData::new_layer(root_pipeline.clone(),
layer_properties,
DoesntWantScrollEvents,
self.opts.tile_size);
new_root.add_child(first_chid);
// Release all tiles from the layer before dropping it.
match self.scene.root {
@ -459,7 +462,12 @@ impl IOCompositor {
layer_properties.pipeline_id,
parent_layer_id) {
Some(ref mut parent_layer) => {
CompositorData::add_child(parent_layer.clone(), layer_properties);
let pipeline = parent_layer.extra_data.borrow().pipeline.clone();
let new_layer = CompositorData::new_layer(pipeline,
layer_properties,
DoesntWantScrollEvents,
parent_layer.tile_size);
parent_layer.add_child(new_layer);
}
None => {
fail!("Compositor: couldn't find parent layer");

View file

@ -68,18 +68,6 @@ impl CompositorData {
Rc::new(Layer::new(layer_properties.rect, tile_size, new_compositor_data))
}
/// Adds a child layer to the layer with the given ID and the given pipeline, if it doesn't
/// exist yet. The child layer will have the same pipeline, tile size, memory limit, and CPU
/// painting status as its parent.
pub fn add_child(layer: Rc<Layer<CompositorData>>,
layer_properties: LayerProperties) {
let new_kid = CompositorData::new_layer(layer.extra_data.borrow().pipeline.clone(),
layer_properties,
DoesntWantScrollEvents,
layer.tile_size);
layer.add_child(new_kid.clone());
}
pub fn update_layer(layer: Rc<Layer<CompositorData>>, layer_properties: LayerProperties) {
layer.extra_data.borrow_mut().epoch = layer_properties.epoch;
layer.extra_data.borrow_mut().background_color = layer_properties.background_color;