Open Loirooriol opened 1 month ago
As an aside does anyone know what max-content doesn't apply?
(FWIW the "rule" that we've been applying to to a lot of these table behaviours, is if "width is auto" do the special behaviour - this comes up a suprising amount in table layout).
Yeah, it's kinda weird that, given enough available space, fit-content
doesn't behave like max-content
:
<!DOCTYPE html>
<div style="width: max-content">
<table style="table-layout: fixed; width: max-content" border>
<tr><td style="width: 0">lorem ipsum</td></tr>
</table>
<table style="table-layout: fixed; width: fit-content" border>
<tr><td style="width: 0">lorem ipsum</td></tr>
</table>
</div>
Only checking for auto
would make this more future-proof.
There was a broken test in https://github.com/web-platform-tests/wpt/blob/master/css/css-tables/fixed-layout-2.html, I have fixed it and tested all the cases above to help with interoperability.
https://github.com/WebKit/WebKit/pull/34706 aligned -webkit-fill-available
with Blink and Gecko.
Situation
https://drafts.csswg.org/css-tables/#table-layout-property says
This is the logic that browsers use for the inline size:
logicalWidth().isSpecified() || logicalWidth().isFitContent() || logicalWidth().isMinContent()
iSize.IsAuto() || iSize.IsMaxContent()
!LogicalWidth().HasAuto() && !LogicalWidth().HasMaxContent()
So we have a mismatch of keywords that accept fixed table layout:
<length-percentage>
auto
min-content
(*)max-content
(*)fit-content
(*)<fit-content()>
contain
stretch
-webkit-fill-available
-moz-available
intrinsic
min-intrinsic
<calc-size()>
should just behave as its basis.(*) including
-webkit-
and-moz-
prefixes. ✅: Supports the value (at least partially), and allows fixed table layout ✅︎: Doesn't support the value, but it would allow fixed table layout ❌: Supports the value (at least partially), and doesn't allows fixed table layout ❌︎: Doesn't support the value, but it wouldn't allow fixed table layoutExample
On Firefox (with
layout.css.webkit-fill-available.enabled = true
) and Blink the table ignores the contents and is almost 0px wide, while on WebKit it's wider according to the text.Changes
I think that
<fit-content()>
should allow fixed table layout, just likefit-content
andmin-content
.And maybe
stretch
should too, to match100%
? Also,-webkit-fill-available
/-moz-available
is kinda the same thing, and it allows fixed table layout on 2/3 of the major browsers.Nobody implements
contain
, but we should also decide what to do with it.