diff --git a/components/layout/block.rs b/components/layout/block.rs index be55574f316..68b149b5c5d 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1913,7 +1913,6 @@ impl Flow for BlockFlow { self.base.position.size.to_physical(self.base.writing_mode); // Compute the origin and clipping rectangle for children. - let relative_offset = relative_offset.to_physical(self.base.writing_mode); let origin_for_children; let clip_in_child_coordinate_system; let is_stacking_context = self.fragment.establishes_stacking_context(); @@ -1925,10 +1924,11 @@ impl Flow for BlockFlow { // // FIXME(pcwalton): Is this vertical-writing-direction-safe? let margin = self.fragment.margin.to_physical(self.base.writing_mode); - origin_for_children = Point2D::new(-margin.left, Au(0)) + relative_offset; + origin_for_children = Point2D::new(-margin.left, Au(0)); clip_in_child_coordinate_system = self.base.clip.translate(&-self.base.stacking_relative_position); } else { + let relative_offset = relative_offset.to_physical(self.base.writing_mode); origin_for_children = self.base.stacking_relative_position + relative_offset; clip_in_child_coordinate_system = self.base.clip.clone(); } diff --git a/tests/ref/basic.list b/tests/ref/basic.list index e68864215a6..dcb270f550b 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -298,6 +298,7 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html == position_relative_inline_block_a.html position_relative_inline_block_ref.html == position_relative_painting_order_a.html position_relative_painting_order_ref.html == position_relative_stacking_context_a.html position_relative_stacking_context_ref.html +== position_relative_stacking_context_contents_a.html position_relative_stacking_context_contents_ref.html == position_relative_top_percentage_a.html position_relative_top_percentage_b.html == position_relative_vertical_percentage_overflow_a.html position_relative_vertical_percentage_overflow_ref.html == pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html diff --git a/tests/ref/position_relative_stacking_context_contents_a.html b/tests/ref/position_relative_stacking_context_contents_a.html new file mode 100644 index 00000000000..78c312699f3 --- /dev/null +++ b/tests/ref/position_relative_stacking_context_contents_a.html @@ -0,0 +1,21 @@ + + + + diff --git a/tests/ref/position_relative_stacking_context_contents_ref.html b/tests/ref/position_relative_stacking_context_contents_ref.html new file mode 100644 index 00000000000..05577cbb481 --- /dev/null +++ b/tests/ref/position_relative_stacking_context_contents_ref.html @@ -0,0 +1,17 @@ + + + +