From 659c45e7b054892fb01bc34022e5d85818c446a9 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Wed, 8 Oct 2014 13:18:44 -0700 Subject: [PATCH] Position layers using their absolute position Layers are currently all children of the root layer, so instead of using coordinates relative to the parent flow we should use coordinates relative to the page. Fixes #2061. --- components/layout/block.rs | 5 +++-- tests/ref/basic.list | 1 + tests/ref/position_fixed_tile_edge_2.html | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/ref/position_fixed_tile_edge_2.html diff --git a/components/layout/block.rs b/components/layout/block.rs index 293d2fee4de..b09c3fc6f3c 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1251,8 +1251,9 @@ impl BlockFlow { let layer_rect = self.base.position.union(&self.base.overflow); let size = Size2D(layer_rect.size.inline.to_nearest_px() as uint, layer_rect.size.block.to_nearest_px() as uint); - let origin = Point2D(layer_rect.start.i.to_nearest_px() as uint, - layer_rect.start.b.to_nearest_px() as uint); + let origin = Point2D(self.base.abs_position.x.to_nearest_px() as uint, + self.base.abs_position.y.to_nearest_px() as uint); + let scroll_policy = if self.is_fixed() { FixedPosition } else { diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 47d3130e4c7..5dcb400f9fe 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -61,6 +61,7 @@ == position_fixed_background_color_a.html position_fixed_background_color_b.html == position_fixed_overflow_a.html position_fixed_overflow_b.html == position_fixed_tile_edge.html position_fixed_tile_edge_ref.html +== position_fixed_tile_edge_2.html position_fixed_tile_edge_ref.html == position_relative_a.html position_relative_b.html == position_relative_top_percentage_a.html position_relative_top_percentage_b.html == background_none_a.html background_none_b.html diff --git a/tests/ref/position_fixed_tile_edge_2.html b/tests/ref/position_fixed_tile_edge_2.html new file mode 100644 index 00000000000..dde70ad965d --- /dev/null +++ b/tests/ref/position_fixed_tile_edge_2.html @@ -0,0 +1,10 @@ + + +
+
+ + +
+
+ +