-
Notifications
You must be signed in to change notification settings - Fork 716
[css-tables][css-sizing] What sizing keywords allow fixed table mode? #10937
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
Comments
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, <!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 |
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. |
…yout https://bugs.webkit.org/show_bug.cgi?id=280900 rdar://137297914 Reviewed by Alan Baradlay. This patch aligns WebKit with Blink / Chromium and Gecko / Firefox. In [1], the test was updated to also ensure that fixed table layout should also account for `fill-available` (-webkit-fill-available). It seems WebKit was not doing it, so this patch is to account for it and progress our behavior. [1] w3c/csswg-drafts#10937 The patch also sync particular test from below: Upstream commit: web-platform-tests/wpt@38d6fa7 * Source/WebCore/rendering/style/RenderStyleInlines.h: (WebCore::RenderStyle::isFixedTableLayout const): * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/fixed-layout-2-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/fixed-layout-2.html: Canonical link: https://commits.webkit.org/284712@main
WebKit/WebKit#34706 aligned |
If I suspect we might indeed just want to hinge the logic on "not |
FYI, on my computer (which is running macOS), ✅ looks identical to ✅︎, and ❌ looks identical to ❌︎, so the table in the original comment is not easily readable. |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> iank_: When we trigger fixed table layout depends on the inline-size property.<fantasai> iank_: This is inconsistent between implementations and spec <fantasai> iank_: As we've added more keywords, it's also changed <fantasai> iank_: Gecko and Blink are consistent with each other, and spec and WebKit are consistent <fantasai> iank_: but spec wasn't kept up to date <fantasai> iank_: Tables generally have a lot of behavior changes when something isn't 'auto' <fantasai> iank_: This triggers for sizing columns, rows, etc. <fantasai> iank_: We're already pretty close on 2 implementations <fantasai> iank_: so easiest resolution would be condition on if inline-size is 'auto' <oriol> q+ <fantasai> oriol: I like this proposed resolution. Note WebKit was aligned with the spec when I filed the issue, but they recently aligned 'fill-available' to align with Blink and Gecko <fantasai> iank_: Also a difference between... if inline-size is not auto, need a different behavior. That's the easiest behavior. <fantasai> iank_: Gecko and Blink also trigger on max-content, but don't see a reason to do that. <astearns> ack oriol <oriol> scribenick:oriol <fantasai> scribe+ oriol <astearns> ack fantasai <oriol> fantasai: I'm trying to think the underlying logic of treating max-content different than min-content, semes weird <oriol> fantasai: allowing fixed layout for stretch and such makes sense <fantasai> fantasai: what does 'intrinsic' mean? <fantasai> oriol: Webkit's non-standard thing, unsure what it's doing <oriol> fantasai: I don't understand what min-intrinsic means <fantasai> iank_: We're advocating to have max-content match min-content/fit-content <fantasai> iank_: Logic is if inline-size is not auto, trigger fixed layout behavior <emilio> q+ <astearns> ack emilio <fantasai> emilio: ?? missed ??. Maybe dbaron remembers <fantasai> astearns: so we're trying to turn table all green except for 'auto' value? <fantasai> iank_: That's correct. <fantasai> astearns: biggest change in WebKit, but changes all browsers <emilio> s/??/looked up the special case, and goes back to the initial implementation by dbaron <oriol> scribe+ fantasai <emilio> s/??/But I also don't see any reason to special-case max-content and not other keywords <emilio> https://bugzilla.mozilla.org/show_bug.cgi?id=311415 <fantasai> fantasai: what does fixed layout do for max-content? <fantasai> iank_: It's not fixed layout, it's also intrinsically sized, but slightly different wa <fantasai> s/wa/way <TabAtkins> iirc, it's mainly just "only pay attention to the first row", right? <fantasai> iank_: It's very confusing <fantasai> iank_: At one point you didn't need to run intrinsic sizing, but we're well past that at this point <fantasai> fantasai: Original justification was that you could do single-pass layout on it <fantasai> iank_: Definitely no longer possible <fantasai> iank_: we definitely compute intrinsic sizes for fixed table layout <TabAtkins> (i remember using it to get reasonable column sizes based on the headings, rather than the body cells) <oriol> fantasai: If you wave a huge table that is huge to layout, can you use fixed to get that? <fantasai> iank_: We'd have to add a new table layout keyword for that to happen. Don't think it's possible today. <fantasai> oriol: Still can bring some perf optimization, since you're ignoring measures of cells not in the first row, so may be faster <fantasai> fantasai: So if doing max-content fixed layout, would size for first row and then lay out table following that? <fantasai> oriol: in servo we don't do anything special except compute different measures for the tracks <fantasai> fantasai: If by "compute different measures" you mean ignore the cell contents, that's pretty significant difference. <fantasai> oriol: whether table is fixed or not is not relevant to intrinsic sizes of table, or the way you compute them ... can affect the final result <fantasai> iank_: Difference between fixed vs auto layout is minimal, they both have a max-content size and min-content size <fantasai> iank_: from my point of view there's not a good perf optimization benefit to it given where web-compat is now <fantasai> iank_: you always need to determine min-content size on everything <fantasai> iank_: there's a max-content size <fantasai> florian: Is it used for perf? Or is it used when just tuning for first row? <fantasai> iank_: Min constraint doesn't even restrict to first row. <miriam> (yes, Florian's comment matches my experience of the use-case) <fantasai> astearns: since the issue isn't about how it generally works, but what triggers it, can we resolve on it works for everything except auto? <fantasai> [general silence] <fantasai> RESOLVED: fixed table layout is triggered except when inline-size is auto |
As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6
As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334}
As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334}
As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334}
…when not auto., a=testonly Automatic update from web-platform-tests [css-tables] Trigger fixed table layout when not auto. As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334} -- wpt-commits: f7a1b42e7d27e916e2953971150e7b39e44aefba wpt-pr: 51072
…when not auto., a=testonly Automatic update from web-platform-tests [css-tables] Trigger fixed table layout when not auto. As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334} -- wpt-commits: f7a1b42e7d27e916e2953971150e7b39e44aefba wpt-pr: 51072
…when not auto., a=testonly Automatic update from web-platform-tests [css-tables] Trigger fixed table layout when not auto. As per: w3c/csswg-drafts#10937 Behind the flag: TableIsAutoFixedLayout. Bug: 397669048 Change-Id: I906da424db40a52e92a026c3ae45b17bef2368c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317355 Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427334} -- wpt-commits: f7a1b42e7d27e916e2953971150e7b39e44aefba wpt-pr: 51072
We were ignoring `table-layout: fixed` both for `inline-size: auto` and ìnline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test.
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test.
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test.
BTW, we didn't discuss this case in detail. @bfgeek interpreted the resolution as implying that But https://drafts.csswg.org/css-values-5/#resolving-calc-size
So not sure if |
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
…35882) We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
So I did this as it matches the "not initial" we've done for other cases in table layout. |
Can you provide some examples of these cases? |
OK it probably makes more sense to discuss these things in another issue. |
…when `inline-size` is `auto`, a=testonly Automatic update from web-platform-tests layout: Only prevent fixed table layout when `inline-size` is `auto` We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com> -- wpt-commits: afa16aa1d44cdc7d33cb4812a794b3ed4c2c8789 wpt-pr: 51231
…when `inline-size` is `auto`, a=testonly Automatic update from web-platform-tests layout: Only prevent fixed table layout when `inline-size` is `auto` We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. w3c/csswg-drafts#10937 (comment) Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com> -- wpt-commits: afa16aa1d44cdc7d33cb4812a794b3ed4c2c8789 wpt-pr: 51231
https://bugs.webkit.org/show_bug.cgi?id=290247 rdar://problem/147636653 Reviewed by Alan Baradlay. This patch aligns WebKit with CSSWG Resolution [1]: [1] w3c/csswg-drafts#10937 (comment) "Fixed table layout is triggered except when inline-size is auto". In this patch, we remove `allow-list` we had for different length types and keep it to just `isAuto()`.` * Source/WebCore/rendering/style/RenderStyleInlines.h: (WebCore::RenderStyle::isFixedTableLayout const): * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/fixed-layout-2-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/292536@main
Uh oh!
There was an error while loading. Please reload this page.
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()
(negated)
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 layout
Example
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.The text was updated successfully, but these errors were encountered: