diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout_2020/flexbox/layout.rs index 7708c64fc97..cdaf2a2233d 100644 --- a/components/layout_2020/flexbox/layout.rs +++ b/components/layout_2020/flexbox/layout.rs @@ -1940,20 +1940,16 @@ impl FlexItemBox { .outer_inline_content_sizes(layout_context, container_writing_mode, || { automatic_min_size }), - FlexAxis::Column => { - let size = self.layout_for_block_content_size( + FlexAxis::Column => self + .layout_for_block_content_size( flex_context_getter(), &pbm, content_box_size, content_min_size_no_auto, content_max_size, IntrinsicSizingMode::Contribution, - ); - ContentSizes { - min_content: size, - max_content: size, - } - }, + ) + .into(), }; let content_box_size = flex_axis.vec2_to_flex_relative(content_box_size); diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index 3af29bed7a1..055548e4739 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -255,14 +255,10 @@ impl ReplacedContent { // FIXME: min/max-content of replaced elements is not defined in // https://dbaron.org/css/intrinsic/ // This seems sensible? - let inline = self - .flow_relative_intrinsic_size(style) + self.flow_relative_intrinsic_size(style) .inline - .unwrap_or(Au::zero()); - ContentSizes { - min_content: inline, - max_content: inline, - } + .unwrap_or(Au::zero()) + .into() } pub fn make_fragments( diff --git a/components/layout_2020/sizing.rs b/components/layout_2020/sizing.rs index d68fdd791b6..c0585a06056 100644 --- a/components/layout_2020/sizing.rs +++ b/components/layout_2020/sizing.rs @@ -68,10 +68,7 @@ impl ContentSizes { impl Zero for ContentSizes { fn zero() -> Self { - Self { - min_content: Au::zero(), - max_content: Au::zero(), - } + Au::zero().into() } fn is_zero(&self) -> bool { @@ -103,6 +100,15 @@ impl ContentSizes { } } +impl From for ContentSizes { + fn from(size: Au) -> Self { + Self { + min_content: size, + max_content: size, + } + } +} + pub(crate) fn outer_inline( style: &ComputedValues, containing_block_writing_mode: WritingMode, @@ -159,10 +165,7 @@ pub(crate) fn outer_inline( BoxSizing::ContentBox => clamped + pb_lengths, BoxSizing::BorderBox => clamped, }; - ContentSizes { - min_content: border_box_size, - max_content: border_box_size, - } + border_box_size.into() }, None => get_content_size().map(|content_box_size| { match box_sizing { diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index e0552481b65..2ed78ef37fc 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -248,10 +248,7 @@ impl<'a> TableLayout<'a> { // These sizes are incorporated after the first row layout pass, when the block size // of the layout is known. let block_measure = CellOrTrackMeasure { - content_sizes: ContentSizes { - min_content: size.block, - max_content: size.block, - }, + content_sizes: size.block.into(), percentage: percentage_contribution.block, }; @@ -1204,14 +1201,10 @@ impl<'a> TableLayout<'a> { continue; }; - let content_size_from_layout = ContentSizes { - min_content: layout.layout.content_block_size, - max_content: layout.layout.content_block_size, - }; self.cell_measures[row_index][column_index] .block .content_sizes - .max_assign(content_size_from_layout); + .max_assign(layout.layout.content_block_size.into()); } } } @@ -2524,10 +2517,7 @@ impl Table { get_size_percentage_contribution_from_style(&row.style, writing_mode); CellOrTrackMeasure { - content_sizes: ContentSizes { - min_content: size, - max_content: size, - }, + content_sizes: size.into(), percentage: percentage_contribution.block, } }