diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 93a04f834c2..026cca1d03b 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -30,16 +30,25 @@ pub(crate) struct AbsolutelyPositionedFragment<'box_> { /// static positions when going up the tree. pub(crate) tree_rank: usize, - pub(crate) inline_start: AbsoluteBoxOffsets, - pub(crate) block_start: AbsoluteBoxOffsets, + inline_start: AbsoluteBoxOffsets, + block_start: AbsoluteBoxOffsets, } #[derive(Clone, Copy, Debug)] -pub(crate) enum AbsoluteBoxOffsets { - StaticStart { start: Length }, - Start { start: NonStatic }, - End { end: NonStatic }, - Both { start: NonStatic, end: NonStatic }, +pub(crate) enum AbsoluteBoxOffsets { + StaticStart { + start: Length, + }, + Start { + start: LengthPercentage, + }, + End { + end: LengthPercentage, + }, + Both { + start: LengthPercentage, + end: LengthPercentage, + }, } impl AbsolutelyPositionedBox { @@ -81,7 +90,7 @@ impl AbsolutelyPositionedBox { initial_static_start: Length, start: LengthPercentageOrAuto, end: LengthPercentageOrAuto, - ) -> AbsoluteBoxOffsets { + ) -> AbsoluteBoxOffsets { match (start.non_auto(), end.non_auto()) { (None, None) => AbsoluteBoxOffsets::StaticStart { start: initial_static_start, @@ -170,7 +179,7 @@ impl<'a> AbsolutelyPositionedFragment<'a> { computed_margin_start: LengthOrAuto, computed_margin_end: LengthOrAuto, solve_margins: impl FnOnce(Length) -> (Length, Length), - box_offsets: AbsoluteBoxOffsets, + box_offsets: AbsoluteBoxOffsets, size: LengthPercentageOrAuto, ) -> (Anchor, LengthOrAuto, Length, Length) { let size = size.percentage_relative_to(containing_size);