Skip to content

Conversation

@Ahmad-S792
Copy link
Contributor

@Ahmad-S792 Ahmad-S792 commented Nov 29, 2025

efd90e2

Fix table column width distribution for colspan with mixed percent and auto columns
https://bugs.webkit.org/show_bug.cgi?id=303263
rdar://165561401

Reviewed by NOBODY (OOPS!).

This patch aligns WebKit with Chromium / Blink and Gecko / Firefox.

When a table has a row with mixed percentage and auto width columns, and
another row with a colspan spanning those columns, the auto column's width
was incorrectly negating the percentage constraint. This caused the width
distribution to be based solely on content width rather than respecting the
percentage values.

The issue occurred in AutoTableLayout::calcEffectiveLogicalWidth() when
distributing the colspan cell's min/max widths. The code had separate paths
for all-fixed columns and all-percent columns, but no proper handling for
mixed percent+auto columns.
The fix adds a new branch that detects when we have mixed percentage and
auto columns. By this point in the code, the earlier percentage distribution
logic has already converted auto columns to effective percentage widths. The
new code calculates the total effective percentage and distributes the
colspan's min/max widths proportionally based on these percentages, similar
to the existing all-percent case.

This ensures that a 90% column and an auto column (converted to ~10%)
receive width in a 90:10 ratio from the spanning cell, properly respecting
the percentage constraint.

Tests: imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-ref.html
       imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto.html
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto.html: Added.
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):

> Rebaselines:
* LayoutTests/platform/gtk/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sequoia-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sequoia-wk2/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sonoma-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-wk2/fast/table/003-expected.txt:
* LayoutTests/platform/mac/fast/table/003-expected.txt:
* LayoutTests/platform/wpe/fast/table/003-expected.txt:

efd90e2

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 ⏳ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp
✅ 🛠 watch
✅ 🛠 watch-sim

@Ahmad-S792 Ahmad-S792 self-assigned this Nov 29, 2025
@Ahmad-S792 Ahmad-S792 added the Tables For bugs specific to tables (both the DOM and rendering issues). label Nov 29, 2025
@Ahmad-S792 Ahmad-S792 marked this pull request as draft November 29, 2025 23:47
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 30, 2025
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Nov 30, 2025
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Fix-table-column-width-distribution-for-colspan-with-mixed-percent-and-auto-columns branch from 28475a9 to 47217d7 Compare November 30, 2025 04:30
@Ahmad-S792 Ahmad-S792 marked this pull request as ready for review November 30, 2025 04:30
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 30, 2025
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Nov 30, 2025
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Fix-table-column-width-distribution-for-colspan-with-mixed-percent-and-auto-columns branch from 47217d7 to 36e210b Compare November 30, 2025 09:08
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 30, 2025
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Dec 1, 2025
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Fix-table-column-width-distribution-for-colspan-with-mixed-percent-and-auto-columns branch from 36e210b to aca72d5 Compare December 1, 2025 00:56
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 1, 2025
…d auto columns

https://bugs.webkit.org/show_bug.cgi?id=303263
rdar://165561401

Reviewed by NOBODY (OOPS!).

This patch aligns WebKit with Chromium / Blink and Gecko / Firefox.

When a table has a row with mixed percentage and auto width columns, and
another row with a colspan spanning those columns, the auto column's width
was incorrectly negating the percentage constraint. This caused the width
distribution to be based solely on content width rather than respecting the
percentage values.

The issue occurred in AutoTableLayout::calcEffectiveLogicalWidth() when
distributing the colspan cell's min/max widths. The code had separate paths
for all-fixed columns and all-percent columns, but no proper handling for
mixed percent+auto columns.
The fix adds a new branch that detects when we have mixed percentage and
auto columns. By this point in the code, the earlier percentage distribution
logic has already converted auto columns to effective percentage widths. The
new code calculates the total effective percentage and distributes the
colspan's min/max widths proportionally based on these percentages, similar
to the existing all-percent case.

This ensures that a 90% column and an auto column (converted to ~10%)
receive width in a 90:10 ratio from the spanning cell, properly respecting
the percentage constraint.

Tests: imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-ref.html
       imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto.html
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/table-colspan-percent-auto.html: Added.
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):

> Rebaselines:
* LayoutTests/platform/gtk/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sequoia-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sequoia-wk2/fast/table/003-expected.txt:
* LayoutTests/platform/mac-sonoma-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-wk1/fast/table/003-expected.txt:
* LayoutTests/platform/mac-wk2/fast/table/003-expected.txt:
* LayoutTests/platform/mac/fast/table/003-expected.txt:
* LayoutTests/platform/wpe/fast/table/003-expected.txt:
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Dec 1, 2025
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Fix-table-column-width-distribution-for-colspan-with-mixed-percent-and-auto-columns branch from aca72d5 to efd90e2 Compare December 1, 2025 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tables For bugs specific to tables (both the DOM and rendering issues).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants