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.
This commit is contained in:
Pu Xingyu 2023-06-01 05:07:52 +08:00
parent 4e1d3a801f
commit 8a6a4e7550

View file

@ -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);