From e9efa60647b6856a6dd4858d8d2f66bd02637050 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 4 Jun 2014 09:29:36 -0700 Subject: [PATCH 1/3] Remove all old layers when creating a new root. Fixes #2259. --- src/components/main/compositing/compositor.rs | 8 +------- src/support/layers/rust-layers | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index c16e5a64001c..261ab4b411ef 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -381,13 +381,7 @@ impl IOCompositor { self.opts.cpu_painting); new_layer.unrendered_color = unrendered_color; - let first_child = self.root_layer.first_child.borrow().clone(); - match first_child { - None => {} - Some(old_layer) => { - ContainerLayer::remove_child(self.root_layer.clone(), old_layer) - } - } + self.root_layer.remove_all_children(); assert!(new_layer.add_child_if_necessary(self.root_layer.clone(), root_pipeline_id, diff --git a/src/support/layers/rust-layers b/src/support/layers/rust-layers index 29a0f4c36292..261bef5849b8 160000 --- a/src/support/layers/rust-layers +++ b/src/support/layers/rust-layers @@ -1 +1 @@ -Subproject commit 29a0f4c36292314671778631e336aa845276c733 +Subproject commit 261bef5849b817df2288f2f7dac5fe8f255a04ab From 2b0134be7bb8a4372f1a8703b5a1b114e65351f6 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 4 Jun 2014 09:39:31 -0700 Subject: [PATCH 2/3] Check the pipeline ID of the new root layer. This isn't related to any known issue, but is just to ensure that the IDs are set correctly within this function. --- src/components/main/compositing/compositor.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index 261ab4b411ef..7f3f14729f1c 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -367,8 +367,10 @@ impl IOCompositor { } _ => { match self.root_pipeline { - Some(ref root_pipeline) => (root_pipeline.clone(), LayerId::null()), - None => fail!("Compositor: Received new layer without initialized pipeline"), + Some(ref root_pipeline) if root_pipeline.id == id => { + (root_pipeline.clone(), LayerId::null()) + }, + _ => fail!("Compositor: Received new layer without initialized pipeline"), } } }; From 81601c21aa840d9b911d11643ea469930b70511c Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 4 Jun 2014 09:57:54 -0700 Subject: [PATCH 3/3] Remove unused delete_layer code. --- src/components/main/compositing/compositor.rs | 20 ----------- .../main/compositing/compositor_layer.rs | 34 ------------------- .../main/compositing/compositor_task.rs | 6 ---- src/components/main/compositing/headless.rs | 2 +- src/components/msg/compositor_msg.rs | 2 -- 5 files changed, 1 insertion(+), 63 deletions(-) diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index 7f3f14729f1c..5c9fca24326e 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -298,10 +298,6 @@ impl IOCompositor { self.set_layer_clip_rect(pipeline_id, layer_id, new_rect); } - (Ok(DeleteLayerGroup(id)), _) => { - self.delete_layer(id); - } - (Ok(Paint(pipeline_id, layer_id, new_layer_buffer_set, epoch)), false) => { self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch); } @@ -474,22 +470,6 @@ impl IOCompositor { } } - fn delete_layer(&mut self, id: PipelineId) { - let ask: bool = match self.compositor_layer { - Some(ref mut layer) => { - assert!(layer.delete(&self.graphics_context, id)); - true - } - None => { - false - } - }; - - if ask { - self.ask_for_tiles(); - } - } - fn paint(&mut self, pipeline_id: PipelineId, layer_id: LayerId, diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index 5e936a07227c..cb85ee538eea 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -857,40 +857,6 @@ impl CompositorLayer { return None } - // Deletes a specified sublayer, including hidden children. Returns false if the layer is not - // found. - pub fn delete(&mut self, - graphics_context: &NativeCompositingGraphicsContext, - pipeline_id: PipelineId) - -> bool { - match self.children.iter().position(|x| x.child.pipeline.id == pipeline_id) { - Some(i) => { - let mut child = self.children.remove(i); - match self.quadtree { - NoTree(..) => {} // Nothing to do - Tree(ref mut quadtree) => { - match *child.get_ref().container.scissor.borrow() { - Some(rect) => { - quadtree.set_status_page(rect, Normal, false); // Unhide this rect - } - None => {} // Nothing to do - } - } - } - - // Send back all tiles to renderer. - child.get_mut_ref().child.clear_all_tiles(); - - self.build_layer_tree(graphics_context); - true - } - None => { - self.children.mut_iter().map(|x| &mut x.child) - .any(|x| x.delete(graphics_context, pipeline_id)) - } - } - } - // Recursively sets occluded portions of quadtrees to Hidden, so that they do not ask for // tile requests. If layers are moved, resized, or deleted, these portions may be updated. fn set_occlusions(&mut self) { diff --git a/src/components/main/compositing/compositor_task.rs b/src/components/main/compositing/compositor_task.rs index 009ab920b52b..ebdb65d60fc3 100644 --- a/src/components/main/compositing/compositor_task.rs +++ b/src/components/main/compositing/compositor_task.rs @@ -126,10 +126,6 @@ impl RenderListener for CompositorChan { self.chan.send(SetLayerClipRect(pipeline_id, layer_id, new_rect)) } - fn delete_layer_group(&self, id: PipelineId) { - self.chan.send(DeleteLayerGroup(id)) - } - fn set_render_state(&self, render_state: RenderState) { self.chan.send(ChangeRenderState(render_state)) } @@ -175,8 +171,6 @@ pub enum Msg { SetLayerPageSize(PipelineId, LayerId, Size2D, Epoch), /// Alerts the compositor that the specified layer's clipping rect has changed. SetLayerClipRect(PipelineId, LayerId, Rect), - /// Alerts the compositor that the specified pipeline has been deleted. - DeleteLayerGroup(PipelineId), /// Scroll a page in a window ScrollFragmentPoint(PipelineId, LayerId, Point2D), /// Requests that the compositor paint the given layer buffer set for the given page size. diff --git a/src/components/main/compositing/headless.rs b/src/components/main/compositing/headless.rs index 1f9fef2ae0bf..6cd34acd28d0 100644 --- a/src/components/main/compositing/headless.rs +++ b/src/components/main/compositing/headless.rs @@ -78,7 +78,7 @@ impl NullCompositor { CreateRootCompositorLayerIfNecessary(..) | CreateDescendantCompositorLayerIfNecessary(..) | SetLayerPageSize(..) | - SetLayerClipRect(..) | DeleteLayerGroup(..) | Paint(..) | + SetLayerClipRect(..) | Paint(..) | ChangeReadyState(..) | ChangeRenderState(..) | ScrollFragmentPoint(..) | SetUnRenderedColor(..) | LoadComplete(..) => () } diff --git a/src/components/msg/compositor_msg.rs b/src/components/msg/compositor_msg.rs index 6e9279388d6e..9ad88386b318 100644 --- a/src/components/msg/compositor_msg.rs +++ b/src/components/msg/compositor_msg.rs @@ -134,8 +134,6 @@ pub trait RenderListener { layer_id: LayerId, new_rect: Rect); - fn delete_layer_group(&self, PipelineId); - /// Sends new tiles for the given layer to the compositor. fn paint(&self, pipeline_id: PipelineId,