layout: Remove clearance parameter from BoxFragment::new() (#37921)

Clearance only applies to block-level boxes, so it was unnecessary to
require it as a parameter. Instead, in block layout we can set it using
the new `.with_clearance()` method.

Testing: Unnecessary (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-08 12:04:37 +02:00 committed by GitHub
parent 8d4988f288
commit c00831f1ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 19 deletions

View file

@ -459,7 +459,6 @@ impl LineItemLayout<'_, '_> {
padding.to_physical(ifc_writing_mode),
border.to_physical(ifc_writing_mode),
margin.to_physical(ifc_writing_mode),
None, /* clearance */
None, /* specific_layout_info */
);

View file

@ -407,7 +407,6 @@ impl OutsideMarker {
PhysicalSides::zero(),
PhysicalSides::zero(),
PhysicalSides::zero(),
None,
flow_layout.specific_layout_info,
)))
}
@ -1173,11 +1172,11 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
pbm.padding.to_physical(containing_block_writing_mode),
pbm.border.to_physical(containing_block_writing_mode),
margin.to_physical(containing_block_writing_mode),
clearance,
flow_layout.specific_layout_info,
)
.with_baselines(flow_layout.baselines)
.with_block_margins_collapsed_with_children(block_margins_collapsed_with_children)
.with_clearance(clearance)
}
impl IndependentFormattingContext {
@ -1286,7 +1285,6 @@ impl IndependentFormattingContext {
pbm.padding.to_physical(containing_block_writing_mode),
pbm.border.to_physical(containing_block_writing_mode),
margin.to_physical(containing_block_writing_mode),
None, /* clearance */
layout.specific_layout_info,
)
.with_baselines(layout.baselines)
@ -1604,11 +1602,11 @@ impl IndependentFormattingContext {
pbm.padding.to_physical(containing_block_writing_mode),
pbm.border.to_physical(containing_block_writing_mode),
margin.to_physical(containing_block_writing_mode),
clearance,
layout.specific_layout_info,
)
.with_baselines(layout.baselines)
.with_block_margins_collapsed_with_children(CollapsedBlockMargins::from_margin(&margin))
.with_clearance(clearance)
}
}
@ -2358,6 +2356,9 @@ impl IndependentFormattingContext {
);
}
// Floats can have clearance, but it's handled internally by the float placement logic,
// so there's no need to store it explicitly in the fragment.
// And atomic inlines don't have clearance.
let fragment = BoxFragment::new(
base_fragment_info,
self.style().clone(),
@ -2366,10 +2367,6 @@ impl IndependentFormattingContext {
pbm.padding.to_physical(container_writing_mode),
pbm.border.to_physical(container_writing_mode),
margin.to_physical(container_writing_mode),
// Floats can have clearance, but it's handled internally by the float placement logic,
// so there's no need to store it explicitly in the fragment.
// And atomic inlines don't have clearance.
None, /* clearance */
specific_layout_info,
);