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

@ -1086,7 +1086,7 @@ impl NonReplacedFormattingContext {
&collapsed_margin_block_start,
containing_block,
&pbm,
&content_size + &pbm.padding_border_sums.into(),
content_size + pbm.padding_border_sums.into(),
&self.style,
);
} else {
@ -1102,12 +1102,10 @@ impl NonReplacedFormattingContext {
});
// Create a PlacementAmongFloats using the minimum size in all dimensions as the object size.
let minimum_size_of_block = &LogicalVec2 {
inline: min_box_size.inline,
block: block_size.auto_is(|| min_box_size.block),
}
.into() +
&pbm.padding_border_sums;
let minimum_size_of_block = LogicalVec2 {
inline: min_box_size.inline.into(),
block: block_size.auto_is(|| min_box_size.block).into(),
} + pbm.padding_border_sums;
let mut placement = PlacementAmongFloats::new(
&sequential_layout_state.floats,
ceiling,
@ -1291,7 +1289,7 @@ fn layout_in_flow_replaced_block_level(
// than defined by section 10.3.3. CSS 2 does not define when a UA may put said
// element next to the float or by how much said element may become narrower."
let collapsed_margin_block_start = CollapsedMargin::new(margin_block_start);
let size = &content_size + &pbm.padding_border_sums.clone();
let size = content_size + pbm.padding_border_sums;
(
clearance,
(margin_inline_start, margin_inline_end),