From 7be30dee8e480dc1e965fe693061a795749d7786 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 18 Dec 2014 17:15:51 +0000 Subject: [PATCH] Fix some writing mode mismatch assertions errors. The rendering is still wrong beause of #2795, but at least we get a rendering. (This test change is just for readability, it should be equivalent to before.) --- components/layout/block.rs | 6 +++--- components/layout/flow.rs | 11 +++++++++-- tests/ref/overconstrained_block.html | 15 +++++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 6ff01eaf6844..827f1f6c704c 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1783,9 +1783,9 @@ impl Flow for BlockFlow { if !flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED) { let kid_base = flow::mut_base(kid); kid_base.stacking_relative_position = - origin_for_children + - (kid_base.position.start + relative_offset).to_physical(writing_mode, - container_size); + origin_for_children + + kid_base.position.start.to_physical(kid_base.writing_mode, container_size) + + relative_offset.to_physical(writing_mode); } flow::mut_base(kid).absolute_position_info = absolute_position_info_for_children; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index bceaef0b2c83..873f6268fd7b 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -1191,20 +1191,27 @@ impl<'a> MutableFlowUtils for &'a mut Flow + 'a { let mut overflow = my_position; if self.is_block_container() { + let writing_mode = base(self).writing_mode; + // FIXME(#2795): Get the real container size + let container_size = Size2D::zero(); for kid in child_iter(self) { if kid.is_store_overflow_delayed() { // Absolute flows will be handled by their CB. If we are // their CB, they will show up in `abs_descendants`. continue; } - let mut kid_overflow = base(kid).overflow; + let kid_base = base(kid); + let mut kid_overflow = kid_base.overflow.convert( + kid_base.writing_mode, writing_mode, container_size); kid_overflow = kid_overflow.translate(&my_position.start); overflow = overflow.union(&kid_overflow) } // FIXME(#2004, pcwalton): This is wrong for `position: fixed`. for descendant_link in mut_base(self).abs_descendants.iter() { - let mut kid_overflow = base(descendant_link).overflow; + let kid_base = base(descendant_link); + let mut kid_overflow = kid_base.overflow.convert( + kid_base.writing_mode, writing_mode, container_size); kid_overflow = kid_overflow.translate(&my_position.start); overflow = overflow.union(&kid_overflow) } diff --git a/tests/ref/overconstrained_block.html b/tests/ref/overconstrained_block.html index 564232f4cd71..83728b446527 100644 --- a/tests/ref/overconstrained_block.html +++ b/tests/ref/overconstrained_block.html @@ -2,14 +2,17 @@ Block with over-contrained margins+borders+padding+width = containing block width -

-

-

-

+

+

+

+