mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Generalize ContainingBlock
's block size to a SizeConstraint
(#34946)
It used to be an `AuOrAuto`, turning it into a `SizeConstraint` allows passing the information about the min and max constraints when the containing block doesn't have a definite block size. This will be useful for table layout. Note that in most cases we were already constructing the containing block from a `SizeConstraint`, but we were calling `to_auto_or()` to turn it into an `AuOrAuto`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
de780dcde4
commit
f66cd172d6
11 changed files with 71 additions and 69 deletions
|
@ -741,7 +741,9 @@ impl LogicalVec2<Size<LengthPercentage>> {
|
|||
|inline_size| inline_size.map(|lp| lp.to_used_value(containing_block.size.inline)),
|
||||
|block_size| {
|
||||
block_size
|
||||
.maybe_map(|lp| lp.maybe_to_used_value(containing_block.size.block.non_auto()))
|
||||
.maybe_map(|lp| {
|
||||
lp.maybe_to_used_value(containing_block.size.block.to_definite())
|
||||
})
|
||||
.unwrap_or_default()
|
||||
},
|
||||
)
|
||||
|
@ -856,6 +858,11 @@ impl SizeConstraint {
|
|||
)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn is_definite(self) -> bool {
|
||||
matches!(self, Self::Definite(_))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn to_definite(self) -> Option<Au> {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue