layout: Make geom.rs logical geoemetry types more ergonomic (#32633)

Make using the logical geometry types more ergonomic by having them all
implement `Copy` (at most 4 64-bit numbers), similar to what `euclid`
does. In addition add an implementation of `Neg` for `LogicalVec` and
`LogicalSides` as it will be used in upcoming table implementation code.
This commit is contained in:
Martin Robinson 2024-06-28 10:20:50 +02:00 committed by GitHub
parent e9cf4d4971
commit adc0fc984d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 80 additions and 102 deletions

View file

@ -1206,7 +1206,7 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
);
let mut placement_rect = placement.place();
placement_rect.start_corner = &placement_rect.start_corner - &ifc_offset_in_float_container;
placement_rect.start_corner -= ifc_offset_in_float_container;
placement_rect.into()
}
@ -2026,7 +2026,7 @@ impl IndependentFormattingContext {
let style = self.style();
let pbm = style.padding_border_margin(ifc.containing_block);
let margin = pbm.margin.auto_is(Au::zero);
let pbm_sums = &(&pbm.padding + &pbm.border) + &margin.clone();
let pbm_sums = pbm.padding + pbm.border + margin;
let mut child_positioning_context = None;
// We need to know the inline size of the atomic before deciding whether to do the line break.
@ -2156,7 +2156,7 @@ impl IndependentFormattingContext {
ifc.process_soft_wrap_opportunity();
}
let size = &pbm_sums.sum() + &fragment.content_rect.size;
let size = pbm_sums.sum() + fragment.content_rect.size;
let baseline_offset = self
.pick_baseline(&fragment.baselines)
.map(|baseline| pbm_sums.block_start + baseline)
@ -2171,7 +2171,7 @@ impl IndependentFormattingContext {
);
ifc.push_line_item_to_unbreakable_segment(LineItem::Atomic(AtomicLineItem {
fragment,
size: size.into(),
size,
positioning_context: child_positioning_context,
baseline_offset_in_parent,
baseline_offset_in_item: baseline_offset,
@ -2402,7 +2402,7 @@ impl<'a> ContentSizesComputation<'a> {
.percentages_relative_to(zero)
.auto_is(Length::zero);
let pbm = &(&margin + &padding) + &border;
let pbm = margin + padding + border;
if inline_box.is_first_fragment {
self.add_length(pbm.inline_start);
}