diff --git a/components/layout_2020/flexbox/layout.rs b/components/layout_2020/flexbox/layout.rs
index e4b4ea080d7..11f8bb2826a 100644
--- a/components/layout_2020/flexbox/layout.rs
+++ b/components/layout_2020/flexbox/layout.rs
@@ -1082,7 +1082,7 @@ impl<'a> FlexItem<'a> {
let cross_size = flex_context.vec2_to_flex_relative(size.clone()).cross;
let fragments = replaced.contents.make_fragments(&replaced.style, size);
FlexItemLayoutResult {
- hypothetical_cross_size: cross_size,
+ hypothetical_cross_size: cross_size.into(),
fragments,
positioning_context,
}
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs
index fbe436511dc..62be9038e03 100644
--- a/components/layout_2020/flow/float.rs
+++ b/components/layout_2020/flow/float.rs
@@ -951,15 +951,18 @@ impl FloatBox {
IndependentFormattingContext::Replaced(ref replaced) => {
// https://drafts.csswg.org/css2/#float-replaced-width
// https://drafts.csswg.org/css2/#inline-replaced-height
- content_size = replaced.contents.used_size_as_if_inline_element(
- containing_block,
- &replaced.style,
- None,
- &pbm,
- );
+ content_size = replaced
+ .contents
+ .used_size_as_if_inline_element(
+ containing_block,
+ &replaced.style,
+ None,
+ &pbm,
+ )
+ .into();
children = replaced
.contents
- .make_fragments(&replaced.style, content_size.clone());
+ .make_fragments(&replaced.style, content_size.clone().into());
},
};
diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs
index 0fb6d905bc0..b4585bd7efe 100644
--- a/components/layout_2020/flow/inline.rs
+++ b/components/layout_2020/flow/inline.rs
@@ -1779,7 +1779,7 @@ impl IndependentFormattingContext {
.make_fragments(&replaced.style, size.clone());
let content_rect = LogicalRect {
start_corner: pbm_sums.start_offset(),
- size,
+ size: size.into(),
};
BoxFragment::new(
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs
index bd6cbb11c8a..0ffac153258 100644
--- a/components/layout_2020/flow/mod.rs
+++ b/components/layout_2020/flow/mod.rs
@@ -1151,14 +1151,14 @@ fn layout_in_flow_replaced_block_level<'a>(
// than defined by section 10.3.3. CSS 2 does not define when a UA may put said
// element next to the float or by how much said element may become narrower."
let collapsed_margin_block_start = CollapsedMargin::new(margin_block_start);
- let size = &content_size + &pbm.padding_border_sums;
+ let size = &content_size + &pbm.padding_border_sums.clone().into();
(clearance, (margin_inline_start, margin_inline_end)) =
solve_clearance_and_inline_margins_avoiding_floats(
sequential_layout_state,
containing_block,
&collapsed_margin_block_start,
&pbm,
- size.clone(),
+ size.clone().into(),
style,
);
@@ -1172,14 +1172,14 @@ fn layout_in_flow_replaced_block_level<'a>(
// Margins can never collapse into replaced elements.
sequential_layout_state.collapse_margins();
sequential_layout_state
- .advance_block_position((size.block + clearance.unwrap_or_else(Length::zero)).into());
+ .advance_block_position(size.block + clearance.unwrap_or_else(Length::zero).into());
sequential_layout_state.adjoin_assign(&CollapsedMargin::new(margin_block_end));
} else {
clearance = None;
(margin_inline_start, margin_inline_end) = solve_inline_margins_for_in_flow_block_level(
containing_block,
&pbm,
- content_size.inline,
+ content_size.inline.into(),
);
};
@@ -1199,7 +1199,7 @@ fn layout_in_flow_replaced_block_level<'a>(
let content_rect = LogicalRect {
start_corner,
- size: content_size,
+ size: content_size.into(),
};
let block_margins_collapsed_with_children = CollapsedBlockMargins::from_margin(&margin);
BoxFragment::new(
diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs
index 67ac1246b36..86a54a1c261 100644
--- a/components/layout_2020/positioned.rs
+++ b/components/layout_2020/positioned.rs
@@ -488,8 +488,8 @@ impl HoistedAbsolutelyPositionedBox {
&pbm,
);
LogicalVec2 {
- inline: LengthOrAuto::LengthPercentage(used_size.inline),
- block: LengthOrAuto::LengthPercentage(used_size.block),
+ inline: LengthOrAuto::LengthPercentage(used_size.inline.into()),
+ block: LengthOrAuto::LengthPercentage(used_size.block.into()),
}
},
IndependentFormattingContext::NonReplaced(non_replaced) => non_replaced
@@ -536,7 +536,7 @@ impl HoistedAbsolutelyPositionedBox {
content_size = computed_size.auto_is(|| unreachable!());
fragments = replaced
.contents
- .make_fragments(style, content_size.clone());
+ .make_fragments(style, content_size.clone().into());
},
IndependentFormattingContext::NonReplaced(non_replaced) => {
// https://drafts.csswg.org/css2/#min-max-widths
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs
index 6e0d65bdbaf..c1baecb5be8 100644
--- a/components/layout_2020/replaced.rs
+++ b/components/layout_2020/replaced.rs
@@ -26,7 +26,7 @@ use crate::dom::NodeExt;
use crate::fragment_tree::{BaseFragmentInfo, Fragment, IFrameFragment, ImageFragment};
use crate::geom::{LogicalRect, LogicalVec2, PhysicalSize};
use crate::sizing::ContentSizes;
-use crate::style_ext::{ComputedValuesExt, PaddingBorderMargin};
+use crate::style_ext::{Clamp, ComputedValuesExt, PaddingBorderMargin};
use crate::ContainingBlock;
#[derive(Debug, Serialize)]
@@ -209,11 +209,8 @@ impl ReplacedContent {
}
}
- fn flow_relative_intrinsic_size(&self, style: &ComputedValues) -> LogicalVec2