diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 392cc7f62e9..bf42f628f09 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -2380,10 +2380,7 @@ impl Fragment { pub fn update_late_computed_replaced_inline_size_if_necessary(&mut self) { if let SpecificFragmentInfo::InlineBlock(ref mut inline_block_info) = self.specific { let block_flow = FlowRef::deref_mut(&mut inline_block_info.flow_ref).as_block(); - let margin = block_flow.fragment.style.logical_margin(); - self.border_box.size.inline = block_flow.fragment.border_box.size.inline + - MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() + - MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero() + self.border_box.size.inline = block_flow.fragment.margin_box_inline_size(); } } diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3e7ec3422b6..2fb9a692943 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -2759,6 +2759,18 @@ {} ] ], + "css/inline_block_percentage_margin.html": [ + [ + "/_mozilla/css/inline_block_percentage_margin.html", + [ + [ + "/_mozilla/css/inline_block_percentage_margin_ref.html", + "==" + ] + ], + {} + ] + ], "css/inline_block_stacking_context_a.html": [ [ "/_mozilla/css/inline_block_stacking_context_a.html", @@ -7875,6 +7887,11 @@ {} ] ], + "css/inline_block_percentage_margin_ref.html": [ + [ + {} + ] + ], "css/inline_block_stacking_context_ref.html": [ [ {} @@ -21797,6 +21814,14 @@ "bad4704435c74a3204925206802eb004f380500e", "support" ], + "css/inline_block_percentage_margin.html": [ + "0b750acad3bcc6b5fabf9e625b6adf22e1e97640", + "reftest" + ], + "css/inline_block_percentage_margin_ref.html": [ + "3726b3b2149b9e6584277fd33b77940d5f9d6800", + "support" + ], "css/inline_block_stacking_context_a.html": [ "6c872ab3c551e4fe6c293468aa310ae61487b583", "reftest" diff --git a/tests/wpt/mozilla/tests/css/inline_block_percentage_margin.html b/tests/wpt/mozilla/tests/css/inline_block_percentage_margin.html new file mode 100644 index 00000000000..83b2b8a88a2 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/inline_block_percentage_margin.html @@ -0,0 +1,16 @@ + + + + + diff --git a/tests/wpt/mozilla/tests/css/inline_block_percentage_margin_ref.html b/tests/wpt/mozilla/tests/css/inline_block_percentage_margin_ref.html new file mode 100644 index 00000000000..3a51b7a1ac5 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/inline_block_percentage_margin_ref.html @@ -0,0 +1,15 @@ + + + +