From e83091d918d55818d41edc4ba93e1ca9f0622bce Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 11 Aug 2015 11:07:18 +1000 Subject: [PATCH] Fix explicit height edge case with absolute / relative nested divs. Needed for #6643. --- components/layout/block.rs | 10 ++--- tests/ref/abs_rel_explicit_height.html | 51 ++++++++++++++++++++++ tests/ref/abs_rel_explicit_height_ref.html | 20 +++++++++ tests/ref/basic.list | 1 + 4 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 tests/ref/abs_rel_explicit_height.html create mode 100644 tests/ref/abs_rel_explicit_height_ref.html diff --git a/components/layout/block.rs b/components/layout/block.rs index 00827a87b47..c8f960dc7cc 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1104,7 +1104,8 @@ impl BlockFlow { let screen_size = LogicalSize::from_physical(self.fragment.style.writing_mode, layout_context.shared.screen_size); Some(screen_size.block) - } else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) { + } else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && + self.base.block_container_explicit_block_size.is_none() { self.base.absolute_cb.explicit_block_containing_size(layout_context) } else { self.base.block_container_explicit_block_size @@ -1329,12 +1330,7 @@ impl BlockFlow { let mut iterator = self.base.child_iter().enumerate().peekable(); while let Some((i, kid)) = iterator.next() { - { - let kid_base = flow::mut_base(kid); - if !kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) { - kid_base.block_container_explicit_block_size = explicit_content_size; - } - } + flow::mut_base(kid).block_container_explicit_block_size = explicit_content_size; // Determine float impaction, and update the inline size speculations if necessary. if flow::base(kid).flags.contains(CLEARS_LEFT) { diff --git a/tests/ref/abs_rel_explicit_height.html b/tests/ref/abs_rel_explicit_height.html new file mode 100644 index 00000000000..22d3e25be5a --- /dev/null +++ b/tests/ref/abs_rel_explicit_height.html @@ -0,0 +1,51 @@ + + + + + + +
+
+
+
+
+
+
+
+
+
+ + diff --git a/tests/ref/abs_rel_explicit_height_ref.html b/tests/ref/abs_rel_explicit_height_ref.html new file mode 100644 index 00000000000..4e9833c2952 --- /dev/null +++ b/tests/ref/abs_rel_explicit_height_ref.html @@ -0,0 +1,20 @@ + + + + + + +
+
+ + diff --git a/tests/ref/basic.list b/tests/ref/basic.list index ffaf75fa5ed..c72b458d070 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -9,6 +9,7 @@ # Should be == with expected failure: fragment=top != ../html/acid2.html acid2_ref.html +== abs_rel_explicit_height.html abs_rel_explicit_height_ref.html == absolute_inline_containing_block_a.html absolute_inline_containing_block_ref.html == acid1_a.html acid1_b.html == acid2_noscroll.html acid2_ref_broken.html