Skip to content

Commit

Permalink
auto merge of #4412 : mbrubeck/servo/fixed-layer-resize, r=mrobinson
Browse files Browse the repository at this point in the history
This fixes a bug where fixed-position layers are not repositioned when the
window is resized.  This can be reproduced with any `position: fixed` element with a `right` or `bottom` position.  I'm not sure how to reftest this, though.

r? @mrobinson
  • Loading branch information
bors-servo committed Dec 18, 2014
2 parents eea49ee + 8dd1a36 commit d7f38a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/compositing/compositor.rs
Expand Up @@ -499,7 +499,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let need_new_root_layer = !self.update_layer_if_exists(layer_properties);
if need_new_root_layer {
let root_layer = self.find_pipeline_root_layer(layer_properties.pipeline_id);
root_layer.update_layer_except_size(layer_properties);
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(
Expand Down
10 changes: 5 additions & 5 deletions components/compositing/compositor_layer.rs
Expand Up @@ -10,7 +10,7 @@ use azure::azure_hl;
use geom::length::Length;
use geom::matrix::identity;
use geom::point::{Point2D, TypedPoint2D};
use geom::size::{Size2D, TypedSize2D};
use geom::size::TypedSize2D;
use geom::rect::Rect;
use gfx::paint_task::UnusedBufferMsg;
use layers::color::Color;
Expand Down Expand Up @@ -69,7 +69,7 @@ impl CompositorData {
}

pub trait CompositorLayer {
fn update_layer_except_size(&self, layer_properties: LayerProperties);
fn update_layer_except_bounds(&self, layer_properties: LayerProperties);

fn update_layer(&self, layer_properties: LayerProperties);

Expand Down Expand Up @@ -166,7 +166,7 @@ pub enum ScrollEventResult {
}

impl CompositorLayer for Layer<CompositorData> {
fn update_layer_except_size(&self, layer_properties: LayerProperties) {
fn update_layer_except_bounds(&self, layer_properties: LayerProperties) {
self.extra_data.borrow_mut().epoch = layer_properties.epoch;
self.extra_data.borrow_mut().scroll_policy = layer_properties.scroll_policy;

Expand All @@ -176,12 +176,12 @@ impl CompositorLayer for Layer<CompositorData> {
}

fn update_layer(&self, layer_properties: LayerProperties) {
self.resize(Size2D::from_untyped(&layer_properties.rect.size));
*self.bounds.borrow_mut() = Rect::from_untyped(&layer_properties.rect);

// Call scroll for bounds checking if the page shrunk. Use (-1, -1) as the
// cursor position to make sure the scroll isn't propagated downwards.
self.handle_scroll_event(TypedPoint2D(0f32, 0f32), TypedPoint2D(-1f32, -1f32));
self.update_layer_except_size(layer_properties);
self.update_layer_except_bounds(layer_properties);
}

// Add LayerBuffers to the specified layer. Returns the layer buffer set back if the layer that
Expand Down

0 comments on commit d7f38a8

Please sign in to comment.