layout: Partial support for sizing keywords on flex items (#35469)

* Add tests for sizing keywords on flex items

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* layout: Partial support for sizing keywords on flex items

When a flex item has `flex-basis: auto`, the used `flex-basis` is the
value of the main size property. In that case, if the main size property
was set to keyword, we were always assuming it was `auto`. Now we handle
non-`auto` keywords correctly.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-02-17 18:51:10 +01:00 committed by GitHub
parent 5fa14c97bd
commit c2224d5afc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 639 additions and 52 deletions

View file

@ -202,28 +202,6 @@ pub(crate) struct ContentBoxSizesAndPBM {
pub depends_on_block_constraints: bool,
}
impl From<ContentBoxSizesAndPBM> for ContentBoxSizesAndPBMDeprecated {
fn from(sizes: ContentBoxSizesAndPBM) -> Self {
Self {
content_box_size: sizes
.content_box_sizes
.map(|size| size.preferred.to_auto_or()),
content_min_box_size: sizes.content_box_sizes.map(|size| size.min.to_auto_or()),
content_max_box_size: sizes.content_box_sizes.map(|size| size.max.to_numeric()),
pbm: sizes.pbm.clone(),
depends_on_block_constraints: sizes.depends_on_block_constraints,
}
}
}
pub(crate) struct ContentBoxSizesAndPBMDeprecated {
pub content_box_size: LogicalVec2<AuOrAuto>,
pub content_min_box_size: LogicalVec2<AuOrAuto>,
pub content_max_box_size: LogicalVec2<Option<Au>>,
pub pbm: PaddingBorderMargin,
pub depends_on_block_constraints: bool,
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) struct BorderStyleColor {
pub style: BorderStyle,