Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YGMeasureModeMinContent and support for computing min/max content sizes of nodes #1298

Open
nicoburns opened this issue May 15, 2023 · 0 comments

Comments

@nicoburns
Copy link
Contributor

nicoburns commented May 15, 2023

Objective

Help make Yoga's flexbox implementation spec compliant.

Context

The spec defines both min-content and max-content sizes, and both are needed to correctly implement CSS layout algorithms. But Yoga currently only supports max-content sizing, which it calls YGMeasureModeUndefined

//    The spec describes four different layout modes: "fill available", "max
//    content", "min content", and "fit content". Of these, we don't use "min
//    content" because we don't support default minimum main sizes (see above
//    for details). Each of our measure modes maps to a layout mode from the
//    spec (https://www.w3.org/TR/CSS3-sizing/#terms):
//      - YGMeasureModeUndefined: max content
//      - YGMeasureModeExactly: fill available
//      - YGMeasureModeAtMost: fit content
//
//    When calling YGNodelayoutImpl and YGLayoutNodeInternal, if the caller
//    passes an available size of undefined then it must also pass a measure
//    mode of YGMeasureModeUndefined in that dimension.

// The spec describes four different layout modes: "fill available", "max

Steps

  • Rename YGMeasureModeUndefined variant of YGMeasureMode enum to YGMeasureModeMaxContent
  • Add YGMeasureModeMinContent variant to YGMeasureMode enum
  • Implement min-content sizing logic. This mostly involves passing through min-content to children. But also requires different sizing behaviour when sizing flex-wrap: wrap nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants