From 9ac759ed80554cc097e0d1c2282edf5d51d28482 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Tue, 6 Jan 2015 12:30:01 -0800 Subject: [PATCH] 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. --- components/compositing/compositor.rs | 22 +++++++++++----------- components/compositing/compositor_task.rs | 6 +++--- components/compositing/headless.rs | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 654bedbf941..3112540c2a9 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -282,8 +282,8 @@ impl IOCompositor { response_channel.send(()); } - (Msg::CreateOrUpdateRootLayer(layer_properties), ShutdownState::NotShuttingDown) => { - self.create_or_update_root_layer(layer_properties); + (Msg::CreateOrUpdateBaseLayer(layer_properties), ShutdownState::NotShuttingDown) => { + self.create_or_update_base_layer(layer_properties); } (Msg::CreateOrUpdateDescendantLayer(layer_properties), @@ -539,24 +539,24 @@ impl IOCompositor { } } - fn create_or_update_root_layer(&mut self, layer_properties: LayerProperties) { - let need_new_root_layer = !self.update_layer_if_exists(layer_properties); - if need_new_root_layer { + fn create_or_update_base_layer(&mut self, layer_properties: LayerProperties) { + let need_new_base_layer = !self.update_layer_if_exists(layer_properties); + if need_new_base_layer { let root_layer = self.find_pipeline_root_layer(layer_properties.pipeline_id); root_layer.update_layer_except_bounds(layer_properties); 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(), layer_properties, WantsScrollEventsFlag::DoesntWantScrollEvents, opts::get().tile_size); - // Add the first child / base layer to the front of the child list, so that - // child iframe layers are painted on top of the base layer. These iframe - // layers were added previously when creating the layer tree skeleton in - // create_frame_tree_root_layers. - root_layer.children().insert(0, first_child); + // Add the base layer to the front of the child list, so that child + // iframe layers are painted on top of the base layer. These iframe + // layers were added previously when creating the layer tree + // skeleton in create_frame_tree_root_layers. + root_layer.children().insert(0, base_layer); } self.scroll_layer_to_fragment_point_if_necessary(layer_properties.pipeline_id, diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 969c1ef0c53..6ceda64cbaf 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -147,7 +147,7 @@ impl PaintListener for Box { for metadata in metadata.iter() { let layer_properties = LayerProperties::new(pipeline_id, epoch, metadata); if first { - self.send(Msg::CreateOrUpdateRootLayer(layer_properties)); + self.send(Msg::CreateOrUpdateBaseLayer(layer_properties)); first = false } else { 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 /// 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 /// layer with that ID exists). CreateOrUpdateDescendantLayer(LayerProperties), @@ -226,7 +226,7 @@ impl Show for Msg { Msg::Exit(..) => write!(f, "Exit"), Msg::ShutdownComplete(..) => write!(f, "ShutdownComplete"), Msg::GetGraphicsMetadata(..) => write!(f, "GetGraphicsMetadata"), - Msg::CreateOrUpdateRootLayer(..) => write!(f, "CreateOrUpdateRootLayer"), + Msg::CreateOrUpdateBaseLayer(..) => write!(f, "CreateOrUpdateBaseLayer"), Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"), Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"), Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"), diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs index 1ae584ff5ea..8b58d727292 100644 --- a/components/compositing/headless.rs +++ b/components/compositing/headless.rs @@ -98,7 +98,7 @@ impl CompositorEventListener for NullCompositor { // we'll notice and think about whether it needs a response, like // SetFrameTree. - Msg::CreateOrUpdateRootLayer(..) | + Msg::CreateOrUpdateBaseLayer(..) | Msg::CreateOrUpdateDescendantLayer(..) | Msg::SetLayerOrigin(..) | Msg::AssignPaintedBuffers(..) |