mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Layout: Clean up Au
conversion helper functions in the flexbox (#31137)
* cleanup helper functions in flexbox * fmt
This commit is contained in:
parent
8dcf3dd0b0
commit
8e6bdb69b1
2 changed files with 8 additions and 32 deletions
|
@ -515,8 +515,8 @@ impl<'a> FlexItem<'a> {
|
|||
let content_max_size = flex_context.vec2_to_flex_relative(max_size);
|
||||
let content_min_size = flex_context.vec2_to_flex_relative(min_size);
|
||||
let margin_auto_is_zero = flex_context.sides_to_flex_relative(margin_auto_is_zero);
|
||||
let padding = flex_context.sides_to_flex_relative(pbm.padding.clone());
|
||||
let border = flex_context.sides_to_flex_relative(pbm.border.clone());
|
||||
let padding = flex_context.sides_to_flex_relative(pbm.padding);
|
||||
let border = flex_context.sides_to_flex_relative(pbm.border);
|
||||
let padding_border = padding.sum_by_axis() + border.sum_by_axis();
|
||||
let pbm_auto_is_zero = padding_border + margin_auto_is_zero.sum_by_axis();
|
||||
|
||||
|
@ -541,8 +541,8 @@ impl<'a> FlexItem<'a> {
|
|||
content_box_size,
|
||||
content_min_size,
|
||||
content_max_size,
|
||||
padding: flex_relative_slides(flex_context.sides_to_flex_relative(pbm.padding)),
|
||||
border: flex_relative_slides(flex_context.sides_to_flex_relative(pbm.border)),
|
||||
padding: padding.map(|t| (*t).into()),
|
||||
border: border.map(|t| (*t).into()),
|
||||
margin,
|
||||
pbm_auto_is_zero,
|
||||
flex_base_size,
|
||||
|
@ -853,8 +853,8 @@ impl FlexLine<'_> {
|
|||
item.box_.style().clone(),
|
||||
item_result.fragments,
|
||||
content_rect,
|
||||
logical_slides(flex_context, item.padding),
|
||||
logical_slides(flex_context, item.border),
|
||||
flex_context.sides_to_flow_relative(item.padding.map(|t| (*t).into())),
|
||||
flex_context.sides_to_flow_relative(item.border.map(|t| (*t).into())),
|
||||
margin,
|
||||
None, /* clearance */
|
||||
// TODO: We should likely propagate baselines from `display: flex`.
|
||||
|
@ -1323,28 +1323,3 @@ impl FlexItem<'_> {
|
|||
self.padding.cross_start.into()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(#29819): Check if this function can be removed after we convert everything to Au.
|
||||
fn logical_slides(
|
||||
flex_context: &mut FlexContext<'_>,
|
||||
item: FlexRelativeSides<Au>,
|
||||
) -> LogicalSides<Length> {
|
||||
let value = flex_context.sides_to_flow_relative(item);
|
||||
|
||||
LogicalSides::<Length> {
|
||||
inline_start: value.inline_start.into(),
|
||||
inline_end: value.inline_end.into(),
|
||||
block_start: value.block_start.into(),
|
||||
block_end: value.block_end.into(),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(#29819): Check if this function can be removed after we convert everything to Au.
|
||||
fn flex_relative_slides(value: FlexRelativeSides<Length>) -> FlexRelativeSides<Au> {
|
||||
FlexRelativeSides::<Au> {
|
||||
cross_start: value.cross_start.into(),
|
||||
cross_end: value.cross_end.into(),
|
||||
main_start: value.main_start.into(),
|
||||
main_end: value.main_end.into(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2405,6 +2405,7 @@ impl<'a> ContentSizesComputation<'a> {
|
|||
had_non_whitespace_content_yet: false,
|
||||
linebreaker: None,
|
||||
ending_inline_pbm_stack: Vec::new(),
|
||||
}.traverse(inline_formatting_context)
|
||||
}
|
||||
.traverse(inline_formatting_context)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue