diff --git a/src/components/compositing/compositor.rs b/src/components/compositing/compositor.rs index 2f9c76545a6..5762277b4d1 100644 --- a/src/components/compositing/compositor.rs +++ b/src/components/compositing/compositor.rs @@ -368,16 +368,13 @@ impl IOCompositor { }; let new_compositor_data = CompositorData::new_root(root_pipeline, layer_properties.epoch, - layer_properties.rect.size, self.opts.cpu_painting, layer_properties.background_color); - let size = layer_properties.rect.size; let new_root = Rc::new(Layer::new(layer_properties.rect, - size, self.opts.tile_size, new_compositor_data)); - CompositorData::add_child(new_root.clone(), layer_properties, size); + CompositorData::add_child(new_root.clone(), layer_properties); // Release all tiles from the layer before dropping it. match self.scene.root { @@ -409,8 +406,7 @@ impl IOCompositor { layer_properties.pipeline_id, parent_layer_id) { Some(ref mut parent_layer) => { - let page_size = root_layer.extra_data.borrow().page_size.unwrap(); - CompositorData::add_child(parent_layer.clone(), layer_properties, page_size); + CompositorData::add_child(parent_layer.clone(), layer_properties); } None => { fail!("Compositor: couldn't find parent layer"); diff --git a/src/components/compositing/compositor_data.rs b/src/components/compositing/compositor_data.rs index 56f295f9f6f..5eca6289b4c 100644 --- a/src/components/compositing/compositor_data.rs +++ b/src/components/compositing/compositor_data.rs @@ -41,10 +41,6 @@ pub struct CompositorData { /// top left corner of the page. pub scroll_offset: TypedPoint2D, - /// The size of the underlying page in page coordinates. This is an option - /// because we may not know the size of the page until layout is finished completely. - pub page_size: Option>, - /// The behavior of this layer when a scroll message is received. pub wants_scroll_events: WantsScrollEventsFlag, @@ -72,7 +68,6 @@ impl CompositorData { pub fn new(pipeline: CompositionPipeline, layer_id: LayerId, epoch: Epoch, - page_size: Option>, cpu_painting: bool, wants_scroll_events: WantsScrollEventsFlag, scroll_policy: ScrollPolicy, @@ -82,7 +77,6 @@ impl CompositorData { pipeline: pipeline, id: layer_id, scroll_offset: TypedPoint2D(0f32, 0f32), - page_size: page_size, wants_scroll_events: wants_scroll_events, scroll_policy: scroll_policy, cpu_painting: cpu_painting, @@ -93,13 +87,11 @@ impl CompositorData { pub fn new_root(pipeline: CompositionPipeline, epoch: Epoch, - page_size: Size2D, cpu_painting: bool, unrendered_color: Color) -> CompositorData { CompositorData::new(pipeline, LayerId::null(), epoch, - Some(page_size), cpu_painting, WantsScrollEvents, FixedPosition, @@ -110,18 +102,15 @@ impl CompositorData { /// 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_properties: LayerProperties, - page_size: Size2D) { + layer_properties: LayerProperties) { let new_compositor_data = CompositorData::new(layer.extra_data.borrow().pipeline.clone(), layer_properties.id, layer_properties.epoch, - Some(page_size), layer.extra_data.borrow().cpu_painting, DoesntWantScrollEvents, layer_properties.scroll_policy, layer_properties.background_color); let new_kid = Rc::new(Layer::new(layer_properties.rect, - page_size, Layer::tile_size(layer.clone()), new_compositor_data)); @@ -210,23 +199,15 @@ impl CompositorData { new_rect)) } + } } pub fn update_layer(layer: Rc>, layer_properties: LayerProperties) { layer.extra_data.borrow_mut().epoch = layer_properties.epoch; layer.extra_data.borrow_mut().unrendered_color = layer_properties.background_color; - CompositorData::resize(layer.clone(), layer_properties.rect.size); - } - // Resize and unhide a pre-existing layer. A new layer's size is set during creation. - fn resize(layer: Rc>, - new_size: Size2D) { - debug!("compositor_data: starting resize_helper()"); - - layer.extra_data.borrow_mut().page_size = Some(new_size); - - let unused_buffers = Layer::resize(layer.clone(), new_size); + let unused_buffers = Layer::resize(layer.clone(), layer_properties.rect.size); if !unused_buffers.is_empty() { let msg = UnusedBufferMsg(unused_buffers); let _ = layer.extra_data.borrow().pipeline.render_chan.send_opt(msg); diff --git a/src/components/compositing/events.rs b/src/components/compositing/events.rs index f10d1ce50d9..5aa202d2bf0 100644 --- a/src/components/compositing/events.rs +++ b/src/components/compositing/events.rs @@ -71,11 +71,7 @@ pub fn handle_scroll_event(layer: Rc>, layer.extra_data.borrow_mut().scroll_offset = old_origin + delta; // bounds checking - let page_size = match layer.extra_data.borrow().page_size { - Some(size) => size, - None => fail!("CompositorData: tried to scroll with no page size set"), - }; - + let page_size = layer.bounds.borrow().size; let window_size = window_size.to_untyped(); let scroll_offset = layer.extra_data.borrow().scroll_offset.to_untyped(); @@ -172,10 +168,7 @@ pub fn move(layer: Rc>, layer.extra_data.borrow_mut().scroll_offset = Point2D::from_untyped(&(origin * -1.0)); // bounds checking - let page_size = match layer.extra_data.borrow().page_size { - Some(size) => size, - None => fail!("CompositorData: tried to scroll with no page size set"), - }; + let page_size = layer.bounds.borrow().size; let window_size = window_size.to_untyped(); let scroll_offset = layer.extra_data.borrow().scroll_offset.to_untyped();