mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Share more code for non-replaced float-avoiding blocks (#34585)
Block-level elements that establish an independent formatting context (or are replaced) need to avoid overlapping floats. In the non-replaced case, we have two different subcases, depending on whether the inline size of the element is known. This patch makes them share more logic. Then `solve_clearance_and_inline_margins_avoiding_floats()` would only be used in the replaced case, so it's removed, inlining its logic. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
0ffa5fa277
commit
acf0074f8a
2 changed files with 46 additions and 86 deletions
|
@ -1103,11 +1103,8 @@ impl SequentialLayoutState {
|
|||
let placement_rect = placement.place();
|
||||
let position = &placement_rect.start_corner;
|
||||
let has_clearance = clear_position.is_some() || position.block > ceiling;
|
||||
let clearance = if has_clearance {
|
||||
Some(position.block - self.position_with_zero_clearance(block_start_margin))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let clearance = has_clearance
|
||||
.then(|| position.block - self.position_with_zero_clearance(block_start_margin));
|
||||
(clearance, placement_rect)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue