Layout 2020: implement clearance as Option<Length>

Clearance was implemented as a Length, where zero meant no clearance.
However, having a clearance of 0px should be different than having
no clearance, since the former can still prevent margin collapse.

This patch keeps the existing behavior, so it won't be possible to get
a clearance of Some(Length::zero()), but it prepares the terrain for
a follow-up to fix calculate_clearance to return the proper thing.
This commit is contained in:
Oriol Brufau 2023-06-23 19:56:55 +02:00
parent a725380db0
commit 6b2bbdd02d
6 changed files with 42 additions and 24 deletions

View file

@ -855,7 +855,7 @@ impl FlexLine<'_> {
flex_context.sides_to_flow_relative(item.padding),
flex_context.sides_to_flow_relative(item.border),
margin,
Length::zero(),
None,
collapsed_margin,
),
item_result.positioning_context,