layout_2020: Specify the used cross size when replaced item is stretched

If the flex item has align-self: stretch, redo layout for its
contents, reating this used size as its definite cross size so that
percentage-sized children can be resolved.
This commit is contained in:
Pu Xingyu 2023-05-27 09:41:10 +08:00
parent 1dbd74f389
commit 77e13260d0

View file

@ -1003,10 +1003,17 @@ impl<'a> FlexItem<'a> {
let pbm = replaced
.style
.padding_border_margin(flex_context.containing_block);
let box_size = used_cross_size_override.map(|size| Vec2 {
inline: replaced
.style
.content_box_size(flex_context.containing_block, &pbm)
.inline,
block: LengthOrAuto::LengthPercentage(size),
});
let size = replaced.contents.used_size_as_if_inline_element(
flex_context.containing_block,
&replaced.style,
None,
box_size,
&pbm,
);
let cross_size = flex_context.vec2_to_flex_relative(size.clone()).cross;