Skip to content

auto table layout doesn't honor "max-width" on table cells, when distributing width between them#59664

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Ahmad-S792:eng/automatic-table-layout-doesn-t-honor-max-width-on-table-cells-when-distributing-width-between-them
Mar 9, 2026
Merged

auto table layout doesn't honor "max-width" on table cells, when distributing width between them#59664
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Ahmad-S792:eng/automatic-table-layout-doesn-t-honor-max-width-on-table-cells-when-distributing-width-between-them

Conversation

@Ahmad-S792
Copy link
Copy Markdown
Contributor

@Ahmad-S792 Ahmad-S792 commented Mar 1, 2026

34394ef

auto table layout doesn't honor "max-width" on table cells, when distributing width between them
https://bugs.webkit.org/show_bug.cgi?id=144338
rdar://171459245

Reviewed by Alan Baradlay.

In AutoTableLayout::recalcColumn(), when a cell has an explicit CSS width,
the value is stored into columnLayout.logicalWidth without consulting the
cell's max-width. This causes max-width to be ignored during fixed-width
column distribution in layout().

Clamp the resolved logicalWidth by the cell's CSS max-width right after
it is computed, so the clamped value flows into columnLayout.logicalWidth
and is respected during width distribution.

Test: imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout.html
      imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout.html

* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout.html: Added.
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):

Canonical link: https://commits.webkit.org/308934@main

58a3c91

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@Ahmad-S792 Ahmad-S792 self-assigned this Mar 1, 2026
@Ahmad-S792 Ahmad-S792 added the Layout and Rendering For bugs with layout and rendering of Web pages. label Mar 1, 2026
Comment thread Source/WebCore/rendering/AutoTableLayout.cpp
@Ahmad-S792 Ahmad-S792 changed the title automatic table layout doesn't honor "max-width" on table cells, when distributing width between them auto table layout doesn't honor "max-width" on table cells, when distributing width between them Mar 8, 2026
@Ahmad-S792 Ahmad-S792 force-pushed the eng/automatic-table-layout-doesn-t-honor-max-width-on-table-cells-when-distributing-width-between-them branch from c1786d6 to 58a3c91 Compare March 8, 2026 08:21
@Ahmad-S792 Ahmad-S792 added the merge-queue Applied to send a pull request to merge-queue label Mar 9, 2026
…ributing width between them

https://bugs.webkit.org/show_bug.cgi?id=144338
rdar://171459245

Reviewed by Alan Baradlay.

In AutoTableLayout::recalcColumn(), when a cell has an explicit CSS width,
the value is stored into columnLayout.logicalWidth without consulting the
cell's max-width. This causes max-width to be ignored during fixed-width
column distribution in layout().

Clamp the resolved logicalWidth by the cell's CSS max-width right after
it is computed, so the clamped value flows into columnLayout.logicalWidth
and is respected during width distribution.

Test: imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout.html
      imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout.html

* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-max-width-auto-layout.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/width-distribution/td-min-width-auto-layout.html: Added.
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):

Canonical link: https://commits.webkit.org/308934@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/automatic-table-layout-doesn-t-honor-max-width-on-table-cells-when-distributing-width-between-them branch from 58a3c91 to 34394ef Compare March 9, 2026 21:13
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 308934@main (34394ef): https://commits.webkit.org/308934@main

Reviewed commits have been landed. Closing PR #59664 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 34394ef into WebKit:main Mar 9, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 9, 2026
@Ahmad-S792 Ahmad-S792 deleted the eng/automatic-table-layout-doesn-t-honor-max-width-on-table-cells-when-distributing-width-between-them branch March 21, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layout and Rendering For bugs with layout and rendering of Web pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants