From d6141edfd449333c50e00833ad6476604bf50ceb Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Tue, 17 Sep 2013 17:40:56 -0500 Subject: [PATCH] Change retrieval of buffers from sublayers to both clip relative to the scrolled position of its parent layer and to offset the origin, since each layer assumes that its origin is 0,0. --- src/components/main/compositing/compositor_layer.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index f11dd54156b..4cc701d2ff6 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -244,10 +244,15 @@ impl CompositorLayer { let transform = |x: &mut CompositorLayerChild| -> bool { match x.container.scissor { Some(scissor) => { - let new_rect = window_rect.intersection(&scissor); + let new_rect = rect.intersection(&scissor); match new_rect { Some(new_rect) => { - x.child.get_buffer_request(new_rect, scale) + // Child layers act as if they are rendered at (0,0), so we + // subtract the layer's (x,y) coords in its containing page + // to make the child_rect appear in coordinates local to it. + let child_rect = Rect(new_rect.origin.sub(&scissor.origin), + new_rect.size); + x.child.get_buffer_request(child_rect, scale) } None => { false //Layer is offscreen