aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/gfx/render_task.rs16
-rw-r--r--tests/ref/basic.list5
-rw-r--r--tests/ref/position_fixed_tile_edge.html5
-rw-r--r--tests/ref/position_fixed_tile_edge_ref.html5
4 files changed, 24 insertions, 7 deletions
diff --git a/components/gfx/render_task.rs b/components/gfx/render_task.rs
index e19db054239..92d9a2de2b0 100644
--- a/components/gfx/render_task.rs
+++ b/components/gfx/render_task.rs
@@ -13,6 +13,7 @@ use render_context::RenderContext;
use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, StolenGLResources};
use azure::AzFloat;
use geom::matrix2d::Matrix2D;
+use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use layers::platform::surface::{NativePaintingGraphicsContext, NativeSurface};
@@ -299,8 +300,15 @@ impl<C:RenderListener + Send> RenderTask<C> {
// Divide up the layer into tiles.
for tile in tiles.iter() {
+ // page_rect is in coordinates relative to the layer origin, but all display list
+ // components are relative to the page origin. We make page_rect relative to
+ // the page origin before passing it to the optimizer.
+ let page_rect =
+ tile.page_rect.translate(&Point2D(render_layer.position.origin.x as f32,
+ render_layer.position.origin.y as f32));
+ let page_rect_au = geometry::f32_rect_to_au_rect(page_rect);
+
// Optimize the display list for this tile.
- let page_rect_au = geometry::f32_rect_to_au_rect(tile.page_rect);
let optimizer = DisplayListOptimizer::new(render_layer.display_list.clone(),
page_rect_au);
let display_list = optimizer.optimize();
@@ -339,10 +347,8 @@ impl<C:RenderListener + Send> RenderTask<C> {
// Apply the translation to render the tile we want.
let matrix: Matrix2D<AzFloat> = Matrix2D::identity();
let matrix = matrix.scale(scale as AzFloat, scale as AzFloat);
- let matrix = matrix.translate(-(tile.page_rect.origin.x) as AzFloat,
- -(tile.page_rect.origin.y) as AzFloat);
- let matrix = matrix.translate(-(render_layer.position.origin.x as AzFloat),
- -(render_layer.position.origin.y as AzFloat));
+ let matrix = matrix.translate(-page_rect.origin.x as AzFloat,
+ -page_rect.origin.y as AzFloat);
ctx.draw_target.set_transform(&matrix);
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index 2383e36e5e6..197b4b22a8a 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -58,6 +58,9 @@
# == position_fixed_a.html position_fixed_b.html
# == position_fixed_simple_a.html position_fixed_simple_b.html
# == position_fixed_static_y_a.html position_fixed_static_y_b.html
+== 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_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
@@ -85,8 +88,6 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html
== overflow_auto.html overflow_simple_b.html
== overflow_scroll.html overflow_simple_b.html
== overflow_simple_a.html overflow_simple_b.html
-== position_fixed_background_color_a.html position_fixed_background_color_b.html
-== position_fixed_overflow_a.html position_fixed_overflow_b.html
== noscript.html noscript_ref.html
== pseudo_inherit.html pseudo_inherit_ref.html
experimental == vertical-lr-blocks.html vertical-lr-blocks_ref.html
diff --git a/tests/ref/position_fixed_tile_edge.html b/tests/ref/position_fixed_tile_edge.html
new file mode 100644
index 00000000000..4a0fd898ea0
--- /dev/null
+++ b/tests/ref/position_fixed_tile_edge.html
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <div style="background: green; position: fixed; top: 0px; left: 512px; width: 20px; height: 20px;"></div>
+ </body>
+</html>
diff --git a/tests/ref/position_fixed_tile_edge_ref.html b/tests/ref/position_fixed_tile_edge_ref.html
new file mode 100644
index 00000000000..21166e47f89
--- /dev/null
+++ b/tests/ref/position_fixed_tile_edge_ref.html
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <div style="background: green; position: absolute; top: 0px; left: 512px; width: 20px; height: 20px;"></div>
+ </body>
+</html>