Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4ab1c5ad01704e7f7c03736a55c57b98dacc47d6
https://github.com/WebKit/WebKit/commit/4ab1c5ad01704e7f7c03736a55c57b98dacc47d6
Author: Alan Baradlay <[email protected]>
Date: 2026-04-28 (Tue, 28 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M
LayoutTests/imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children.html
M Source/WebCore/rendering/RenderTable.cpp
Log Message:
-----------
Fix imported/w3c/web-platform-tests/css/css-tables/absolute-tables-015.html
https://bugs.webkit.org/show_bug.cgi?id=313500
Reviewed by Antti Koivisto.
A table with width: 0px was treated as width: auto, causing
percentage column scaling to inflate the table to its max-content
width instead of its min-content width.
For example:
<table style="width: 0px">
<td style="width: 100%;">
<span style="display: inline-block; width: 100px; height: 50px;"></span>
<span style="display: inline-block; width: 100px; height: 50px;"></span>
</td>
</table>
Expected: table is 100px (min-content), spans stack vertically.
Actual: table is 200px (max-content scaled by td width: 100%).
The condition in RenderTable::updateLogicalWidth that decides
whether to use the specified-width path or the auto-width path was:
styleLogicalWidth.isSpecified() && styleLogicalWidth.isPossiblyPositive()
isPossiblyPositive() returns false for 0, so width: 0px fell into
the auto-width path. The auto-width path uses
scaledWidthFromPercentColumns (from td width: 100%), which scales
the max-content width (204) to fill the available space (200).
The fix adds isKnownZero() to the condition so width: 0px takes
the specified-width path: the table gets width 0, then line 341
expands it to minPreferredLogicalWidth (100 - the min-content).
* LayoutTests/TestExpectations:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children.html:
* Source/WebCore/rendering/RenderTable.cpp:
(WebCore::RenderTable::updateLogicalWidth):
imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children.html:
This also changes the behavior of percentage-sized replaced
children inside width: 0px tables. Consider:
<table style="width: 0px;">
<td><input style="width: 100%;"></td>
</table>
The input's width: 100% creates a cyclic dependency -- the table
width depends on the column width, which depends on the input's
intrinsic size contribution, which depends on width: 100% of the
table width. CSS Sizing 3 section 5.2 breaks this cycle:
- Rule (b): for max-content, treat the percentage as auto
(input uses intrinsic width, ~142px)
- Rule (c): for min-content of replaced elements, resolve
against zero (100% of 0 = 0)
Previously, the auto-width path used max-content with percentage
scaling, giving the table 142px and the input 142px. Now, the
specified-width path uses min-content (rule c): the
table stays at 0, and the input resolves 100% of 0 = 0.
This matches Chrome and Firefox.
Canonical link: https://commits.webkit.org/312204@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications