Fix root layer naming in the compositor

The term "root layer" is used in the compositor to refer to both the
pipeline root layer and the page background layer. This can be quite
confusing. Instead, call the page background layer the "base layer,"
which is always the first child of the pipeline root layer.
This commit is contained in:
Martin Robinson 2015-01-06 12:30:01 -08:00
parent ad751e4926
commit 9ac759ed80
3 changed files with 15 additions and 15 deletions

View file

@ -282,8 +282,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
response_channel.send(()); response_channel.send(());
} }
(Msg::CreateOrUpdateRootLayer(layer_properties), ShutdownState::NotShuttingDown) => { (Msg::CreateOrUpdateBaseLayer(layer_properties), ShutdownState::NotShuttingDown) => {
self.create_or_update_root_layer(layer_properties); self.create_or_update_base_layer(layer_properties);
} }
(Msg::CreateOrUpdateDescendantLayer(layer_properties), (Msg::CreateOrUpdateDescendantLayer(layer_properties),
@ -539,24 +539,24 @@ impl<Window: WindowMethods> IOCompositor<Window> {
} }
} }
fn create_or_update_root_layer(&mut self, layer_properties: LayerProperties) { fn create_or_update_base_layer(&mut self, layer_properties: LayerProperties) {
let need_new_root_layer = !self.update_layer_if_exists(layer_properties); let need_new_base_layer = !self.update_layer_if_exists(layer_properties);
if need_new_root_layer { if need_new_base_layer {
let root_layer = self.find_pipeline_root_layer(layer_properties.pipeline_id); let root_layer = self.find_pipeline_root_layer(layer_properties.pipeline_id);
root_layer.update_layer_except_bounds(layer_properties); root_layer.update_layer_except_bounds(layer_properties);
let root_layer_pipeline = root_layer.extra_data.borrow().pipeline.clone(); let root_layer_pipeline = root_layer.extra_data.borrow().pipeline.clone();
let first_child = CompositorData::new_layer( let base_layer = CompositorData::new_layer(
root_layer_pipeline.clone(), root_layer_pipeline.clone(),
layer_properties, layer_properties,
WantsScrollEventsFlag::DoesntWantScrollEvents, WantsScrollEventsFlag::DoesntWantScrollEvents,
opts::get().tile_size); opts::get().tile_size);
// Add the first child / base layer to the front of the child list, so that // Add the base layer to the front of the child list, so that child
// child iframe layers are painted on top of the base layer. These iframe // iframe layers are painted on top of the base layer. These iframe
// layers were added previously when creating the layer tree skeleton in // layers were added previously when creating the layer tree
// create_frame_tree_root_layers. // skeleton in create_frame_tree_root_layers.
root_layer.children().insert(0, first_child); root_layer.children().insert(0, base_layer);
} }
self.scroll_layer_to_fragment_point_if_necessary(layer_properties.pipeline_id, self.scroll_layer_to_fragment_point_if_necessary(layer_properties.pipeline_id,

View file

@ -147,7 +147,7 @@ impl PaintListener for Box<CompositorProxy+'static+Send> {
for metadata in metadata.iter() { for metadata in metadata.iter() {
let layer_properties = LayerProperties::new(pipeline_id, epoch, metadata); let layer_properties = LayerProperties::new(pipeline_id, epoch, metadata);
if first { if first {
self.send(Msg::CreateOrUpdateRootLayer(layer_properties)); self.send(Msg::CreateOrUpdateBaseLayer(layer_properties));
first = false first = false
} else { } else {
self.send(Msg::CreateOrUpdateDescendantLayer(layer_properties)); self.send(Msg::CreateOrUpdateDescendantLayer(layer_properties));
@ -183,7 +183,7 @@ pub enum Msg {
/// Tells the compositor to create the root layer for a pipeline if necessary (i.e. if no layer /// Tells the compositor to create the root layer for a pipeline if necessary (i.e. if no layer
/// with that ID exists). /// with that ID exists).
CreateOrUpdateRootLayer(LayerProperties), CreateOrUpdateBaseLayer(LayerProperties),
/// Tells the compositor to create a descendant layer for a pipeline if necessary (i.e. if no /// Tells the compositor to create a descendant layer for a pipeline if necessary (i.e. if no
/// layer with that ID exists). /// layer with that ID exists).
CreateOrUpdateDescendantLayer(LayerProperties), CreateOrUpdateDescendantLayer(LayerProperties),
@ -226,7 +226,7 @@ impl Show for Msg {
Msg::Exit(..) => write!(f, "Exit"), Msg::Exit(..) => write!(f, "Exit"),
Msg::ShutdownComplete(..) => write!(f, "ShutdownComplete"), Msg::ShutdownComplete(..) => write!(f, "ShutdownComplete"),
Msg::GetGraphicsMetadata(..) => write!(f, "GetGraphicsMetadata"), Msg::GetGraphicsMetadata(..) => write!(f, "GetGraphicsMetadata"),
Msg::CreateOrUpdateRootLayer(..) => write!(f, "CreateOrUpdateRootLayer"), Msg::CreateOrUpdateBaseLayer(..) => write!(f, "CreateOrUpdateBaseLayer"),
Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"), Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"),
Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"), Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"),
Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"), Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"),

View file

@ -98,7 +98,7 @@ impl CompositorEventListener for NullCompositor {
// we'll notice and think about whether it needs a response, like // we'll notice and think about whether it needs a response, like
// SetFrameTree. // SetFrameTree.
Msg::CreateOrUpdateRootLayer(..) | Msg::CreateOrUpdateBaseLayer(..) |
Msg::CreateOrUpdateDescendantLayer(..) | Msg::CreateOrUpdateDescendantLayer(..) |
Msg::SetLayerOrigin(..) | Msg::SetLayerOrigin(..) |
Msg::AssignPaintedBuffers(..) | Msg::AssignPaintedBuffers(..) |