mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove AbsoluteBoxOffsets’s type parameter
This commit is contained in:
parent
f43dc3afcb
commit
e86222d6bb
1 changed files with 18 additions and 9 deletions
|
@ -30,16 +30,25 @@ pub(crate) struct AbsolutelyPositionedFragment<'box_> {
|
||||||
/// static positions when going up the tree.
|
/// static positions when going up the tree.
|
||||||
pub(crate) tree_rank: usize,
|
pub(crate) tree_rank: usize,
|
||||||
|
|
||||||
pub(crate) inline_start: AbsoluteBoxOffsets<LengthPercentage>,
|
inline_start: AbsoluteBoxOffsets,
|
||||||
pub(crate) block_start: AbsoluteBoxOffsets<LengthPercentage>,
|
block_start: AbsoluteBoxOffsets,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub(crate) enum AbsoluteBoxOffsets<NonStatic> {
|
pub(crate) enum AbsoluteBoxOffsets {
|
||||||
StaticStart { start: Length },
|
StaticStart {
|
||||||
Start { start: NonStatic },
|
start: Length,
|
||||||
End { end: NonStatic },
|
},
|
||||||
Both { start: NonStatic, end: NonStatic },
|
Start {
|
||||||
|
start: LengthPercentage,
|
||||||
|
},
|
||||||
|
End {
|
||||||
|
end: LengthPercentage,
|
||||||
|
},
|
||||||
|
Both {
|
||||||
|
start: LengthPercentage,
|
||||||
|
end: LengthPercentage,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbsolutelyPositionedBox {
|
impl AbsolutelyPositionedBox {
|
||||||
|
@ -81,7 +90,7 @@ impl AbsolutelyPositionedBox {
|
||||||
initial_static_start: Length,
|
initial_static_start: Length,
|
||||||
start: LengthPercentageOrAuto,
|
start: LengthPercentageOrAuto,
|
||||||
end: LengthPercentageOrAuto,
|
end: LengthPercentageOrAuto,
|
||||||
) -> AbsoluteBoxOffsets<LengthPercentage> {
|
) -> AbsoluteBoxOffsets {
|
||||||
match (start.non_auto(), end.non_auto()) {
|
match (start.non_auto(), end.non_auto()) {
|
||||||
(None, None) => AbsoluteBoxOffsets::StaticStart {
|
(None, None) => AbsoluteBoxOffsets::StaticStart {
|
||||||
start: initial_static_start,
|
start: initial_static_start,
|
||||||
|
@ -170,7 +179,7 @@ impl<'a> AbsolutelyPositionedFragment<'a> {
|
||||||
computed_margin_start: LengthOrAuto,
|
computed_margin_start: LengthOrAuto,
|
||||||
computed_margin_end: LengthOrAuto,
|
computed_margin_end: LengthOrAuto,
|
||||||
solve_margins: impl FnOnce(Length) -> (Length, Length),
|
solve_margins: impl FnOnce(Length) -> (Length, Length),
|
||||||
box_offsets: AbsoluteBoxOffsets<LengthPercentage>,
|
box_offsets: AbsoluteBoxOffsets,
|
||||||
size: LengthPercentageOrAuto,
|
size: LengthPercentageOrAuto,
|
||||||
) -> (Anchor, LengthOrAuto, Length, Length) {
|
) -> (Anchor, LengthOrAuto, Length, Length) {
|
||||||
let size = size.percentage_relative_to(containing_size);
|
let size = size.percentage_relative_to(containing_size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue