From e86222d6bb073269fe20b427f797ed1ab9c972f8 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 7 Dec 2019 23:38:21 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20AbsoluteBoxOffsets=E2=80=99s=20type=20?= =?UTF-8?q?parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layout_2020/positioned.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) 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);