-
Notifications
You must be signed in to change notification settings - Fork 711
[css-sizing] Intrinsic contribution of fit-content()
with cyclic percentages
#11805
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
Labels
Comments
Loirooriol
added a commit
to Loirooriol/servo
that referenced
this issue
Mar 19, 2025
Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of w3c/csswg-drafts#11805 Signed-off-by: Oriol Brufau <[email protected]>
4 tasks
Loirooriol
added a commit
to Loirooriol/servo
that referenced
this issue
Mar 21, 2025
Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of w3c/csswg-drafts#11805 Signed-off-by: Oriol Brufau <[email protected]>
Loirooriol
added a commit
to Loirooriol/servo
that referenced
this issue
Mar 23, 2025
Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of w3c/csswg-drafts#11805 Signed-off-by: Oriol Brufau <[email protected]>
github-merge-queue bot
pushed a commit
to servo/servo
that referenced
this issue
Mar 23, 2025
Spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content It's similar to the `fit-content` keyword but, instead of clamping the stretch size between `min-content` and `max-content`, it clamps the provided argument. So now that we support `fit-content`, it's quite straightforward to add. It's just not completely clear what should happen when the argument has a cyclic percentage, so this may need some further adjustments depending on the outcome of w3c/csswg-drafts#11805 Signed-off-by: Oriol Brufau <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to https://drafts.csswg.org/css-sizing-3/#cyclic-percentage-contribution
This means that the intrinsic min/max-content contributions of
#b
are1000px
.But does this make sense? Once
#b
is laid out with a1000px
wide containing block, its size will resolve to50px
. It's normal for the intrinsic contributions to not match the final size, but here it looks weird since we know50px
will be an upper limit. Also, in #10721 there are 2 proposals under consideration, but both treatmax-width: fit-content
asmax-content
when computing the max-content contribution. So if we do that forfit-content
, it seems we should do the same for a cyclicfit-content()
.Then, proposal:
<length-percentage>
would resolve cyclic percentages against zero, thenfit-content(<length-percentage>)
resolves cyclic percentages against zero.Note: the condition never holds in browsers, but it does in the spec. See [css-sizing] Nobody follows the spec about cyclic percentages in min sizing properties #10969 and [css-sizing] Nobody follows the spec about cyclic percentages in preferred&max sizing properties of replaced element #11452.
<length-percentage>
with cyclic percentages is treated as0px
, thenfit-content(<length-percentage>)
with cyclic percentages is treated asfit-content(0px)
i.e.min-content
.Note: the condition never holds in the spec, but it does in browsers.
<length-percentage>
with cyclic percentages is treated asnone
, thenfit-content(<length-percentage>)
with cyclic percentages is treated asfit-content(calc(1px * infinity))
i.e.max-content
.<length-percentage>
with cyclic percentages is treated as the automatic size, thenfit-content(<length-percentage>)
with cyclic percentages is treated asfit-content
, i.e.min-content
for the min-content contribution andmax-content
for the max-content contribution.<length-percentage>
with cyclic percentages is treated as the automatic minimum size, thenfit-content(<length-percentage>)
with cyclic percentages is treated asmin-content
.Note: the condition never holds in the spec, and almost never holds in browsers.
The text was updated successfully, but these errors were encountered: