layout: Compute intrinsic sizes for flex items and flex containers (#32854)

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Delan Azabani 2024-08-02 14:45:11 +08:00 committed by GitHub
parent 7495ba20a5
commit 974c9dc89a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 625 additions and 222 deletions

View file

@ -7,7 +7,7 @@ use std::borrow::Cow;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use style::values::specified::text::TextDecorationLine;
use super::{FlexContainer, FlexLevelBox};
use super::{FlexContainer, FlexItemBox, FlexLevelBox};
use crate::cell::ArcRefCell;
use crate::context::LayoutContext;
use crate::dom::{BoxSlot, LayoutBox, NodeExt};
@ -176,9 +176,11 @@ where
),
};
Some(ArcRefCell::new(FlexLevelBox::FlexItem(
IndependentFormattingContext::NonReplaced(non_replaced),
)))
Some(ArcRefCell::new(FlexLevelBox::FlexItem(FlexItemBox {
independent_formatting_context: IndependentFormattingContext::NonReplaced(
non_replaced,
),
})))
},
FlexLevelJob::Element {
info,
@ -201,15 +203,15 @@ where
)),
))
} else {
ArcRefCell::new(FlexLevelBox::FlexItem(
IndependentFormattingContext::construct(
ArcRefCell::new(FlexLevelBox::FlexItem(FlexItemBox {
independent_formatting_context: IndependentFormattingContext::construct(
self.context,
&info,
display_inside,
contents,
self.text_decoration_line,
),
))
}))
};
box_slot.set(LayoutBox::FlexLevel(box_.clone()));
Some(box_)
@ -227,6 +229,9 @@ where
FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(_) => 0,
});
FlexContainer { children }
FlexContainer {
children,
style: self.info.style.clone(),
}
}
}