mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Enable min-content, max-content, fit-content and stretch (#33492)
For the sizing properties. We don't actually support them yet, just treating them as the initial value. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
4bde9af515
commit
9597390d2b
66 changed files with 120 additions and 2798 deletions
|
@ -147,14 +147,12 @@ impl MarginCollapseInfo {
|
|||
) -> (CollapsibleMargins, Au) {
|
||||
let state = match self.state {
|
||||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||
let content_block_size = fragment.style().content_block_size();
|
||||
may_collapse_through = may_collapse_through &&
|
||||
match fragment.style().content_block_size() {
|
||||
Size::Auto => true,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.is_definitely_zero() ||
|
||||
lp.maybe_to_used_value(containing_block_size).is_none()
|
||||
},
|
||||
};
|
||||
content_block_size.is_definitely_zero() ||
|
||||
content_block_size
|
||||
.maybe_to_used_value(containing_block_size)
|
||||
.is_none();
|
||||
|
||||
if may_collapse_through {
|
||||
if fragment.style.min_block_size().is_auto() ||
|
||||
|
@ -522,12 +520,7 @@ impl MaybeAuto {
|
|||
///
|
||||
/// `style_length`: content size as given in the CSS.
|
||||
pub fn style_length(style_length: &Size, container_size: Option<Au>) -> MaybeAuto {
|
||||
match style_length {
|
||||
Size::Auto => MaybeAuto::Auto,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.0.maybe_to_used_value(container_size))
|
||||
},
|
||||
}
|
||||
MaybeAuto::from_option(style_length.maybe_to_used_value(container_size))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -595,17 +588,10 @@ impl SizeConstraint {
|
|||
max_size: &MaxSize,
|
||||
border: Option<Au>,
|
||||
) -> SizeConstraint {
|
||||
let mut min_size = match min_size {
|
||||
Size::Auto => Au(0),
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(container_size).unwrap_or(Au(0))
|
||||
},
|
||||
};
|
||||
|
||||
let mut max_size = match max_size {
|
||||
MaxSize::None => None,
|
||||
MaxSize::LengthPercentage(ref lp) => lp.maybe_to_used_value(container_size),
|
||||
};
|
||||
let mut min_size = min_size
|
||||
.maybe_to_used_value(container_size)
|
||||
.unwrap_or(Au(0));
|
||||
let mut max_size = max_size.maybe_to_used_value(container_size);
|
||||
|
||||
// Make sure max size is not smaller than min size.
|
||||
max_size = max_size.map(|x| max(x, min_size));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue