Re: [csswg-drafts] [css-sizing] Stretch-fitting inline size next to floats. (#4028)

So I have (very) strong feelings 😀  that it should go beside the float.

Basically the nice thing about the new `stretch` keyword is that it explains the other half of `width:auto`.

In Blink, we _never_ resolve an `auto` length, instead we coerce it to either `fit-content` or `stretch` length depending on the context.

E.g. In `grid` layout `auto` behaves as `stretch` for non-replaced elements, and `fit-content` for replaced.

For block layout the rules are a little more complex but basically: replaced, tables, floats, and some form controls are `fit-content` everything else is `stretch`.

For new formatting contexts with "auto-as-stretch", all engines today consider the available space for this calculation as adjusted for floats.

Basically I'd like to keep the invariant that engines can coerce `auto` to `fit-content`, or `stretch`. (Note this also becomes important for `calc-size()` FWIW).

If we don't go down this path to fully "explain" `auto` we'd need to introduce a new variant, e.g. `stretch-respecting-floats` that I'd prefer not to do.

From the web-developer perspective if we go with the "next-to-float" definition:
 - If they want to clear the float and take up the full content-box area they can just do `clear: both`.
 - If they want to make something that is `auto` as `fit-content` to stretch next to a float they can just do `width: stretch`.
   (e.g. `<input style="width: stretch">`)

If we go with the "clears-floats" definition:
 - They aren't able to make something that is `auto` as `fit-content` stretch next to a float. 😢 

The "next-to-float" definition is strictly more powerful for developers.

@dholbert - Does this make sense?


-- 
GitHub Notification of comment by bfgeek
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4028#issuecomment-2372348130 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 24 September 2024 20:42:16 UTC