Skip to main content

resolve_sizing_keyword

Function resolve_sizing_keyword 

Source
pub(crate) fn resolve_sizing_keyword(
    style: Dimension,
    stretch_size: Option<f32>,
    percent_resolution_basis: Option<f32>,
) -> Option<SizingKeywordResolution>
Expand description

Resolve an item’s size style in one axis if it is a sizing keyword (min-content, max-content, fit-content, fit-content(...), or stretch).

  • stretch_size is the size the item would take if stretched to fill the available space (available space minus margins). Used by fit-content and stretch.
  • percent_resolution_basis is the size that percentages resolve against in this axis. Used by fit-content(<percentage>).

Returns None if the size style is not a sizing keyword, or if it cannot be resolved in the current context (in which case it behaves as auto).