Skip to content

Commit b63a076

Browse files
committed
fix: flex baseline alignment should extends the container height based on descent
1 parent 562b29f commit b63a076

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

float-pigment-layout/src/algo/flex_box.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
886886
.map(|child| {
887887
if child.final_align_self == AlignSelf::Baseline {
888888
child.first_baseline_ascent.cross_axis(dir)
889+
+ child.margin.cross_axis_start(dir, cross_dir_rev).or_zero()
889890
} else {
890891
T::Length::zero()
891892
}
@@ -896,17 +897,17 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
896897
.items
897898
.iter()
898899
.map(|child| {
899-
if child.final_align_self == AlignSelf::Baseline
900-
&& child.margin.cross_axis_start(dir, cross_dir_rev).is_none()
901-
&& child.margin.cross_axis_end(dir, cross_dir_rev).is_none()
902-
{
900+
dbg!(&child.first_baseline_ascent, &child.margin);
901+
if child.final_align_self == AlignSelf::Baseline {
903902
max_baseline - child.first_baseline_ascent.cross_axis(dir)
904903
+ child.hypothetical_outer_size.cross_size(dir)
904+
+ child.margin.cross_axis_end(dir, cross_dir_rev).or_zero()
905905
} else {
906906
child.hypothetical_outer_size.cross_size(dir)
907907
}
908908
})
909909
.fold(T::Length::zero(), |acc, x| acc.max(x));
910+
dbg!(line.cross_size, max_baseline);
910911
}
911912

912913
// If the flex container is single-line, then clamp the line’s cross-size to be within the container’s computed min

0 commit comments

Comments
 (0)