Remove calculate_clearance_and_adjoin_margin (#30033)

It was useful when it had 3 callers, but #29977 removed 2 of them.
This commit is contained in:
Oriol Brufau 2023-07-26 23:34:04 +02:00 committed by GitHub
parent 628aeec95a
commit e0e970af31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View file

@ -981,22 +981,6 @@ impl SequentialLayoutState {
Some(clear_position - position_with_zero_clearance) Some(clear_position - position_with_zero_clearance)
} }
/// Helper function that computes the clearance and adds `block_start_margin` accordingly.
/// If there is no clearance, `block_start_margin` can just be adjoined to `current_margin`.
/// But clearance prevents them from collapsing, so `collapse_margins()` is called.
pub(crate) fn calculate_clearance_and_adjoin_margin(
&mut self,
style: &Arc<ComputedValues>,
block_start_margin: &CollapsedMargin,
) -> Option<Length> {
let clearance = self.calculate_clearance(ClearSide::from_style(style), &block_start_margin);
if clearance.is_some() {
self.collapse_margins();
}
self.adjoin_assign(&block_start_margin);
clearance
}
/// Adds a new adjoining margin. /// Adds a new adjoining margin.
pub(crate) fn adjoin_assign(&mut self, margin: &CollapsedMargin) { pub(crate) fn adjoin_assign(&mut self, margin: &CollapsedMargin) {
self.current_margin.adjoin_assign(margin) self.current_margin.adjoin_assign(margin)

View file

@ -654,7 +654,11 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
// Introduce clearance if necessary. // Introduce clearance if necessary.
clearance = sequential_layout_state clearance = sequential_layout_state
.calculate_clearance_and_adjoin_margin(style, &block_start_margin); .calculate_clearance(ClearSide::from_style(style), &block_start_margin);
if clearance.is_some() {
sequential_layout_state.collapse_margins();
}
sequential_layout_state.adjoin_assign(&block_start_margin);
if !start_margin_can_collapse_with_children { if !start_margin_can_collapse_with_children {
sequential_layout_state.collapse_margins(); sequential_layout_state.collapse_margins();
} }