mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Rename MozLength to Size, and MaxLength to MaxSize.
MozLength is not a very descriptive name. If we're going to use it in both Gecko and Servo we may as well name it something more accurate. I would've chosen `ContentSize` per CSS2[1][2] if it wasn't a lie in presence of box-sizing. I don't have better ideas than `Size`, given that. [1]: https://drafts.csswg.org/css2/visudet.html#propdef-width [2]: https://drafts.csswg.org/css2/box.html#content-width Differential Revision: https://phabricator.services.mozilla.com/D19280
This commit is contained in:
parent
7ed6b9d3ce
commit
c2819365f0
26 changed files with 280 additions and 333 deletions
|
@ -67,9 +67,7 @@ use style::context::SharedStyleContext;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{
|
||||
LengthPercentageOrAuto, MaxLength, NonNegativeLengthPercentageOrAuto,
|
||||
};
|
||||
use style::values::computed::{LengthPercentageOrAuto, MaxSize, Size};
|
||||
|
||||
/// Information specific to floated blocks.
|
||||
#[derive(Clone, Serialize)]
|
||||
|
@ -421,24 +419,24 @@ impl CandidateBSizeIterator {
|
|||
// `min-height` and `max-height`, percentage values are ignored.
|
||||
|
||||
let block_size = match fragment.style.content_block_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => MaybeAuto::Auto,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
|
||||
},
|
||||
};
|
||||
|
||||
let max_block_size = match fragment.style.max_block_size() {
|
||||
MaxLength::None => None,
|
||||
MaxLength::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(block_container_block_size)
|
||||
},
|
||||
MaxSize::None => None,
|
||||
MaxSize::LengthPercentage(ref lp) => lp.maybe_to_used_value(block_container_block_size),
|
||||
};
|
||||
|
||||
let min_block_size = fragment
|
||||
.style
|
||||
.min_block_size()
|
||||
.maybe_to_used_value(block_container_block_size)
|
||||
.unwrap_or(Au(0));
|
||||
let min_block_size = match fragment.style.min_block_size() {
|
||||
Size::Auto => MaybeAuto::Auto,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.maybe_to_used_value(block_container_block_size))
|
||||
},
|
||||
}
|
||||
.specified_or_zero();
|
||||
|
||||
// If the style includes `box-sizing: border-box`, subtract the border and padding.
|
||||
let adjustment_for_box_sizing = match fragment.style.get_position().box_sizing {
|
||||
|
@ -1402,7 +1400,7 @@ impl BlockFlow {
|
|||
let content_block_size = self.fragment.style().content_block_size();
|
||||
|
||||
match content_block_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => {
|
||||
Size::Auto => {
|
||||
let container_size = containing_block_size?;
|
||||
let (block_start, block_end) = {
|
||||
let position = self.fragment.style().logical_position();
|
||||
|
@ -1437,9 +1435,7 @@ impl BlockFlow {
|
|||
(_, _) => None,
|
||||
}
|
||||
},
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(containing_block_size)
|
||||
},
|
||||
Size::LengthPercentage(ref lp) => lp.maybe_to_used_value(containing_block_size),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1796,7 +1792,8 @@ impl BlockFlow {
|
|||
.fragment
|
||||
.style()
|
||||
.min_inline_size()
|
||||
.to_used_value(self.base.block_container_inline_size);
|
||||
.to_used_value(self.base.block_container_inline_size)
|
||||
.unwrap_or(Au(0));
|
||||
let specified_inline_size = self.fragment.style().content_inline_size();
|
||||
let container_size = self.base.block_container_inline_size;
|
||||
let inline_size = match specified_inline_size.to_used_value(container_size) {
|
||||
|
@ -2025,7 +2022,7 @@ impl BlockFlow {
|
|||
// If `max-width` is set, then don't perform this speculation. We guess that the
|
||||
// page set `max-width` in order to avoid hitting floats. The search box on Google
|
||||
// SERPs falls into this category.
|
||||
if self.fragment.style.max_inline_size() != MaxLength::None {
|
||||
if self.fragment.style.max_inline_size() != MaxSize::None {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2157,10 +2154,8 @@ impl Flow for BlockFlow {
|
|||
// rather than bubbling up children inline width.
|
||||
// FIXME(emilio): This should probably be writing-mode-aware.
|
||||
let consult_children = match self.fragment.style().get_position().width {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => true,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None).is_none()
|
||||
},
|
||||
Size::Auto => true,
|
||||
Size::LengthPercentage(ref lp) => lp.maybe_to_used_value(None).is_none(),
|
||||
};
|
||||
self.bubble_inline_sizes_for_block(consult_children);
|
||||
self.fragment
|
||||
|
@ -2911,7 +2906,8 @@ pub trait ISizeAndMarginsComputer {
|
|||
.fragment()
|
||||
.style()
|
||||
.min_inline_size()
|
||||
.to_used_value(containing_block_inline_size);
|
||||
.to_used_value(containing_block_inline_size)
|
||||
.unwrap_or(Au(0));
|
||||
if computed_min_inline_size > solution.inline_size {
|
||||
input.computed_inline_size = MaybeAuto::Specified(computed_min_inline_size);
|
||||
solution = self.solve_inline_size_constraints(block, &input);
|
||||
|
|
|
@ -29,9 +29,7 @@ use style::logical_geometry::{Direction, LogicalSize};
|
|||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::flex::FlexBasis;
|
||||
use style::values::computed::{
|
||||
MaxLength, NonNegativeLengthPercentage, NonNegativeLengthPercentageOrAuto,
|
||||
};
|
||||
use style::values::computed::{MaxSize, Size};
|
||||
use style::values::generics::flex::FlexBasis as GenericFlexBasis;
|
||||
|
||||
/// The size of an axis. May be a specified size, a min/max
|
||||
|
@ -46,21 +44,12 @@ enum AxisSize {
|
|||
impl AxisSize {
|
||||
/// Generate a new available cross or main axis size from the specified size of the container,
|
||||
/// containing block size, min constraint, and max constraint
|
||||
pub fn new(
|
||||
size: NonNegativeLengthPercentageOrAuto,
|
||||
content_size: Option<Au>,
|
||||
min: NonNegativeLengthPercentage,
|
||||
max: MaxLength,
|
||||
) -> AxisSize {
|
||||
pub fn new(size: Size, content_size: Option<Au>, min: Size, max: MaxSize) -> AxisSize {
|
||||
match size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => {
|
||||
AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None))
|
||||
},
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
match lp.maybe_to_used_value(content_size) {
|
||||
Some(length) => AxisSize::Definite(length),
|
||||
None => AxisSize::Infinite,
|
||||
}
|
||||
Size::Auto => AxisSize::MinMax(SizeConstraint::new(content_size, min, max, None)),
|
||||
Size::LengthPercentage(ref lp) => match lp.maybe_to_used_value(content_size) {
|
||||
Some(length) => AxisSize::Definite(length),
|
||||
None => AxisSize::Infinite,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -70,26 +59,20 @@ impl AxisSize {
|
|||
/// and the container size, then return the used value of flex basis. it can be used to help
|
||||
/// determining the flex base size and to indicate whether the main size of the item
|
||||
/// is definite after flex size resolving.
|
||||
fn from_flex_basis(
|
||||
flex_basis: FlexBasis,
|
||||
main_length: NonNegativeLengthPercentageOrAuto,
|
||||
containing_length: Au,
|
||||
) -> MaybeAuto {
|
||||
fn from_flex_basis(flex_basis: FlexBasis, main_length: Size, containing_length: Au) -> MaybeAuto {
|
||||
let width = match flex_basis {
|
||||
GenericFlexBasis::Content => return MaybeAuto::Auto,
|
||||
GenericFlexBasis::Width(width) => width,
|
||||
};
|
||||
|
||||
let width = match width {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => main_length,
|
||||
Size::Auto => main_length,
|
||||
_ => width,
|
||||
};
|
||||
|
||||
match width {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::Specified(lp.to_used_value(containing_length))
|
||||
},
|
||||
Size::Auto => MaybeAuto::Auto,
|
||||
Size::LengthPercentage(ref lp) => MaybeAuto::Specified(lp.to_used_value(containing_length)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +166,8 @@ impl FlexItem {
|
|||
.fragment
|
||||
.style
|
||||
.min_inline_size()
|
||||
.to_used_value(containing_length);
|
||||
.to_used_value(containing_length)
|
||||
.unwrap_or(Au(0));
|
||||
},
|
||||
Direction::Block => {
|
||||
let basis = from_flex_basis(
|
||||
|
@ -205,7 +189,8 @@ impl FlexItem {
|
|||
.fragment
|
||||
.style
|
||||
.min_block_size()
|
||||
.to_used_value(containing_length);
|
||||
.to_used_value(containing_length)
|
||||
.unwrap_or(Au(0));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use style::computed_values::float::T as StyleFloat;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::values::computed::NonNegativeLengthPercentageOrAuto;
|
||||
use style::values::computed::Size;
|
||||
|
||||
/// The kind of float: left or right.
|
||||
#[derive(Clone, Copy, Debug, Serialize)]
|
||||
|
@ -549,8 +549,8 @@ impl SpeculatedFloatPlacement {
|
|||
// might flow around this float.
|
||||
let inline_size = flow.as_block().fragment.style.content_inline_size();
|
||||
let fixed = match inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => false,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => false,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.0.is_definitely_zero() || lp.0.maybe_to_used_value(None).is_some()
|
||||
},
|
||||
};
|
||||
|
|
|
@ -61,9 +61,7 @@ use style::selector_parser::RestyleDamage;
|
|||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::str::char_is_whitespace;
|
||||
use style::values::computed::counters::ContentItem;
|
||||
use style::values::computed::{
|
||||
LengthPercentage, LengthPercentageOrAuto, NonNegativeLengthPercentageOrAuto,
|
||||
};
|
||||
use style::values::computed::{LengthPercentage, LengthPercentageOrAuto, Size};
|
||||
use style::values::generics::box_::{Perspective, VerticalAlign};
|
||||
use style::values::generics::transform;
|
||||
use webrender_api::{self, LayoutTransform};
|
||||
|
@ -991,7 +989,13 @@ impl Fragment {
|
|||
.content_inline_size()
|
||||
.to_used_value(Au(0))
|
||||
.unwrap_or(Au(0));
|
||||
specified = max(style.min_inline_size().to_used_value(Au(0)), specified);
|
||||
specified = max(
|
||||
style
|
||||
.min_inline_size()
|
||||
.to_used_value(Au(0))
|
||||
.unwrap_or(Au(0)),
|
||||
specified,
|
||||
);
|
||||
if let Some(max) = style.max_inline_size().to_used_value(Au(0)) {
|
||||
specified = min(specified, max)
|
||||
}
|
||||
|
@ -1615,10 +1619,8 @@ impl Fragment {
|
|||
SpecificFragmentInfo::Iframe(_) |
|
||||
SpecificFragmentInfo::Svg(_) => {
|
||||
let inline_size = match self.style.content_inline_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => None,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
},
|
||||
Size::Auto => None,
|
||||
Size::LengthPercentage(ref lp) => lp.maybe_to_used_value(None),
|
||||
};
|
||||
|
||||
let mut inline_size = inline_size.unwrap_or_else(|| {
|
||||
|
|
|
@ -11,10 +11,8 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use style::logical_geometry::{LogicalMargin, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::MaxLength;
|
||||
use style::values::computed::{
|
||||
LengthPercentageOrAuto, NonNegativeLengthPercentage, NonNegativeLengthPercentageOrAuto,
|
||||
};
|
||||
use style::values::computed::MaxSize;
|
||||
use style::values::computed::{LengthPercentageOrAuto, Size};
|
||||
|
||||
/// A collapsible margin. See CSS 2.1 § 8.3.1.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
@ -137,15 +135,17 @@ impl MarginCollapseInfo {
|
|||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||
may_collapse_through = may_collapse_through &&
|
||||
match fragment.style().content_block_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => true,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => true,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.is_definitely_zero() ||
|
||||
lp.maybe_to_used_value(containing_block_size).is_none()
|
||||
},
|
||||
};
|
||||
|
||||
if may_collapse_through {
|
||||
if fragment.style().min_block_size().is_definitely_zero() {
|
||||
if fragment.style.min_block_size().is_auto() ||
|
||||
fragment.style().min_block_size().is_definitely_zero()
|
||||
{
|
||||
FinalMarginState::MarginsCollapseThrough
|
||||
} else {
|
||||
// If the fragment has non-zero min-block-size, margins may not
|
||||
|
@ -498,13 +498,10 @@ impl MaybeAuto {
|
|||
/// Receive an optional container size and return used value for width or height.
|
||||
///
|
||||
/// `style_length`: content size as given in the CSS.
|
||||
pub fn style_length(
|
||||
style_length: NonNegativeLengthPercentageOrAuto,
|
||||
container_size: Option<Au>,
|
||||
) -> MaybeAuto {
|
||||
pub fn style_length(style_length: Size, container_size: Option<Au>) -> MaybeAuto {
|
||||
match style_length {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => MaybeAuto::Auto,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::from_option(lp.0.maybe_to_used_value(container_size))
|
||||
},
|
||||
}
|
||||
|
@ -571,17 +568,20 @@ impl SizeConstraint {
|
|||
/// Create a `SizeConstraint` for an axis.
|
||||
pub fn new(
|
||||
container_size: Option<Au>,
|
||||
min_size: NonNegativeLengthPercentage,
|
||||
max_size: MaxLength,
|
||||
min_size: Size,
|
||||
max_size: MaxSize,
|
||||
border: Option<Au>,
|
||||
) -> SizeConstraint {
|
||||
let mut min_size = min_size
|
||||
.maybe_to_used_value(container_size)
|
||||
.unwrap_or(Au(0));
|
||||
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 {
|
||||
MaxLength::None => None,
|
||||
MaxLength::LengthPercentage(ref lp) => lp.maybe_to_used_value(container_size),
|
||||
MaxSize::None => None,
|
||||
MaxSize::LengthPercentage(ref lp) => lp.maybe_to_used_value(container_size),
|
||||
};
|
||||
|
||||
// Make sure max size is not smaller than min size.
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::fmt;
|
|||
use std::sync::Arc;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{MaxLength, NonNegativeLengthPercentageOrAuto};
|
||||
use style::values::computed::{MaxSize, Size};
|
||||
use style::values::generics::column::ColumnCount;
|
||||
use style::values::Either;
|
||||
|
||||
|
@ -155,14 +155,12 @@ impl Flow for MulticolFlow {
|
|||
available_block_size: {
|
||||
let style = &self.block_flow.fragment.style;
|
||||
let size = match style.content_block_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => None,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None)
|
||||
},
|
||||
Size::Auto => None,
|
||||
Size::LengthPercentage(ref lp) => lp.maybe_to_used_value(None),
|
||||
};
|
||||
let size = size.or_else(|| match style.max_block_size() {
|
||||
MaxLength::None => None,
|
||||
MaxLength::LengthPercentage(ref lp) => lp.maybe_to_used_value(None),
|
||||
MaxSize::None => None,
|
||||
MaxSize::LengthPercentage(ref lp) => lp.maybe_to_used_value(None),
|
||||
});
|
||||
|
||||
size.unwrap_or_else(|| {
|
||||
|
|
|
@ -33,7 +33,7 @@ use style::logical_geometry::LogicalSize;
|
|||
use style::properties::style_structs::Background;
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::NonNegativeLengthPercentageOrAuto;
|
||||
use style::values::computed::Size;
|
||||
use style::values::CSSFloat;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -301,14 +301,14 @@ impl Flow for TableFlow {
|
|||
self.column_intrinsic_inline_sizes
|
||||
.push(ColumnIntrinsicInlineSize {
|
||||
minimum_length: match *specified_inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => Au(0),
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => Au(0),
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.maybe_to_used_value(None).unwrap_or(Au(0))
|
||||
},
|
||||
},
|
||||
percentage: match *specified_inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => 0.0,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::Auto => 0.0,
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
lp.0.as_percentage().map_or(0.0, |p| p.0)
|
||||
},
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@ use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode;
|
|||
use std::fmt;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::length::NonNegativeLengthPercentageOrAuto;
|
||||
use style::values::computed::length::Size;
|
||||
use style::values::computed::Color;
|
||||
use style::values::generics::box_::VerticalAlign;
|
||||
use style::values::specified::BorderStyle;
|
||||
|
@ -203,8 +203,8 @@ impl Flow for TableCellFlow {
|
|||
|
||||
self.block_flow.bubble_inline_sizes_for_block(true);
|
||||
let specified_inline_size = match self.block_flow.fragment.style().content_inline_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => Au(0),
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => lp.to_used_value(Au(0)),
|
||||
Size::Auto => Au(0),
|
||||
Size::LengthPercentage(ref lp) => lp.to_used_value(Au(0)),
|
||||
};
|
||||
|
||||
if self
|
||||
|
|
|
@ -14,7 +14,7 @@ use euclid::Point2D;
|
|||
use std::fmt;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::NonNegativeLengthPercentageOrAuto;
|
||||
use style::values::computed::Size;
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableColGroupFlow {}
|
||||
|
@ -34,7 +34,7 @@ pub struct TableColGroupFlow {
|
|||
/// The specified inline-sizes of table columns. (We use `LengthPercentageOrAuto` here in
|
||||
/// lieu of `ColumnInlineSize` because column groups do not establish minimum or preferred
|
||||
/// inline sizes.)
|
||||
pub inline_sizes: Vec<NonNegativeLengthPercentageOrAuto>,
|
||||
pub inline_sizes: Vec<Size>,
|
||||
}
|
||||
|
||||
impl TableColGroupFlow {
|
||||
|
|
|
@ -29,7 +29,7 @@ use style::computed_values::border_spacing::T as BorderSpacing;
|
|||
use style::computed_values::border_top_style::T as BorderStyle;
|
||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{Color, NonNegativeLengthPercentageOrAuto};
|
||||
use style::values::computed::{Color, Size};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableRowFlow {}
|
||||
|
@ -429,24 +429,18 @@ impl Flow for TableRowFlow {
|
|||
let child_base = kid.mut_base();
|
||||
let child_column_inline_size = ColumnIntrinsicInlineSize {
|
||||
minimum_length: match child_specified_inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => None,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.0.maybe_to_used_value(None)
|
||||
},
|
||||
Size::Auto => None,
|
||||
Size::LengthPercentage(ref lp) => lp.0.maybe_to_used_value(None),
|
||||
}
|
||||
.unwrap_or(child_base.intrinsic_inline_sizes.minimum_inline_size),
|
||||
percentage: match child_specified_inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => 0.0,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.0.as_percentage().map_or(0.0, |p| p.0)
|
||||
},
|
||||
Size::Auto => 0.0,
|
||||
Size::LengthPercentage(ref lp) => lp.0.as_percentage().map_or(0.0, |p| p.0),
|
||||
},
|
||||
preferred: child_base.intrinsic_inline_sizes.preferred_inline_size,
|
||||
constrained: match child_specified_inline_size {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => false,
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
lp.0.maybe_to_used_value(None).is_some()
|
||||
},
|
||||
Size::Auto => false,
|
||||
Size::LengthPercentage(ref lp) => lp.0.maybe_to_used_value(None).is_some(),
|
||||
},
|
||||
};
|
||||
min_inline_size = min_inline_size + child_column_inline_size.minimum_length;
|
||||
|
|
|
@ -33,7 +33,7 @@ use style::computed_values::{position, table_layout};
|
|||
use style::context::SharedStyleContext;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::NonNegativeLengthPercentageOrAuto;
|
||||
use style::values::computed::Size;
|
||||
use style::values::CSSFloat;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize)]
|
||||
|
@ -201,7 +201,7 @@ impl TableWrapperFlow {
|
|||
// says "the basic idea is the same as the shrink-to-fit width that CSS2.1 defines". So we
|
||||
// just use the shrink-to-fit inline size.
|
||||
let available_inline_size = match self.block_flow.fragment.style().content_inline_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => {
|
||||
Size::Auto => {
|
||||
self.block_flow
|
||||
.get_shrink_to_fit_inline_size(available_inline_size) -
|
||||
table_border_padding
|
||||
|
@ -841,7 +841,7 @@ fn initial_computed_inline_size(
|
|||
table_border_padding: Au,
|
||||
) -> MaybeAuto {
|
||||
match block.fragment.style.content_inline_size() {
|
||||
NonNegativeLengthPercentageOrAuto::Auto => {
|
||||
Size::Auto => {
|
||||
if preferred_width_of_all_columns + table_border_padding <= containing_block_inline_size
|
||||
{
|
||||
MaybeAuto::Specified(preferred_width_of_all_columns + table_border_padding)
|
||||
|
@ -851,7 +851,7 @@ fn initial_computed_inline_size(
|
|||
MaybeAuto::Auto
|
||||
}
|
||||
},
|
||||
NonNegativeLengthPercentageOrAuto::LengthPercentage(ref lp) => {
|
||||
Size::LengthPercentage(ref lp) => {
|
||||
let used = lp.to_used_value(containing_block_inline_size);
|
||||
MaybeAuto::Specified(max(
|
||||
used - table_border_padding,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue