From 8a6a4e75506f3f29e9c74a1831530abd923b87f5 Mon Sep 17 00:00:00 2001 From: Pu Xingyu Date: Thu, 1 Jun 2023 05:07:52 +0800 Subject: [PATCH] layout_2020: Only count for content size for height of non-replaced inline elements Accorinding to https://drafts.csswg.org/css2/#inline-non-replaced, The vertical padding, border and margin of an inline, non-replaced box start at the top and bottom of the content area, and has nothing to do with the line-height. But only the line-height is used when calculating the height of the line box. --- components/layout_2020/flow/inline.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index 740c34cf7c0..1f07204ae8f 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -461,7 +461,7 @@ impl InlineBox { margin.inline_start = Length::zero(); } let mut start_corner = Vec2 { - block: padding.block_start + border.block_start + margin.block_start, + block: Length::zero(), inline: ifc.inline_position - ifc.current_nesting_level.inline_start, }; if style.clone_position().is_relative() { @@ -533,12 +533,7 @@ impl<'box_tree> PartialInlineBoxFragment<'box_tree> { } self.parent_nesting_level .max_block_size_of_fragments_so_far - .max_assign( - fragment.content_rect.size.block + - fragment.padding.block_sum() + - fragment.border.block_sum() + - fragment.margin.block_sum(), - ); + .max_assign(fragment.content_rect.size.block); if let Some(context) = nesting_level.positioning_context.as_mut() { context.layout_collected_children(layout_context, &mut fragment);