diff --git a/components/layout/block.rs b/components/layout/block.rs index 4f69a9487d8..fa91b847b20 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1751,7 +1751,7 @@ impl Flow for BlockFlow { self.base.position.size.block = self.fragment.border_box.size.block; } None - } else if self.is_root() || self.base.flags.is_float() || self.is_inline_block() { + } else if self.is_root() || self.formatting_context_type() != FormattingContextType::None { // Root element margins should never be collapsed according to CSS ยง 8.3.1. debug!("assign_block_size: assigning block_size for root flow {:?}", flow::base(self).debug_id()); diff --git a/tests/wpt/metadata-css/css21_dev/html4/margin-collapse-009.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/margin-collapse-009.htm.ini deleted file mode 100644 index 6627a225d8a..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/margin-collapse-009.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[margin-collapse-009.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 69c05eaecdc..121842c43ff 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -579,6 +579,18 @@ "url": "/_mozilla/css/block_formatting_context_float_placement_a.html" } ], + "css/block_formatting_context_margin_collapse_a.html": [ + { + "path": "css/block_formatting_context_margin_collapse_a.html", + "references": [ + [ + "/_mozilla/css/block_formatting_context_margin_collapse_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/block_formatting_context_margin_collapse_a.html" + } + ], "css/block_formatting_context_max_width_a.html": [ { "path": "css/block_formatting_context_max_width_a.html", @@ -7193,6 +7205,18 @@ "url": "/_mozilla/css/block_formatting_context_float_placement_a.html" } ], + "css/block_formatting_context_margin_collapse_a.html": [ + { + "path": "css/block_formatting_context_margin_collapse_a.html", + "references": [ + [ + "/_mozilla/css/block_formatting_context_margin_collapse_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/block_formatting_context_margin_collapse_a.html" + } + ], "css/block_formatting_context_max_width_a.html": [ { "path": "css/block_formatting_context_max_width_a.html", diff --git a/tests/wpt/mozilla/tests/css/block_formatting_context_margin_collapse_a.html b/tests/wpt/mozilla/tests/css/block_formatting_context_margin_collapse_a.html new file mode 100644 index 00000000000..787505d08c2 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/block_formatting_context_margin_collapse_a.html @@ -0,0 +1,28 @@ + + +