Skip to content

Commit

Permalink
Fix imported/w3c/web-platform-tests/css/css-tables/auto-layout-calc-w…
Browse files Browse the repository at this point in the history
…idth-001.html

https://bugs.webkit.org/show_bug.cgi?id=262918
<rdar://problem/116697508>

Reviewed by Antti Koivisto.

Calc width on col is treated as auto in auto tables.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-tables/auto-layout-calc-width-001-expected.txt:
* Source/WebCore/rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):

Canonical link: https://commits.webkit.org/269139@main
  • Loading branch information
alanbaradlay committed Oct 10, 2023
1 parent 486a572 commit 5d37f68
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
7 changes: 3 additions & 4 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -6493,12 +6493,11 @@ imported/w3c/web-platform-tests/css/css-scrollbars/scrollbar-width-paint-005.htm
imported/w3c/web-platform-tests/css/css-scrollbars/scrollbar-width-paint-006.html [ Skip ]

# Imported WPT css-tables which are crashing or fails.
imported/w3c/web-platform-tests/css/css-tables/auto-layout-calc-width-001.html [ Crash ]
imported/w3c/web-platform-tests/css/css-tables/fixed-layout-calc-width-001.html [ Crash ]
imported/w3c/web-platform-tests/css/css-tables/calc-percent-plus-0px-auto.html [ Crash ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/calc-percent-plus-0px-auto.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/calc-percent-plus-0px-fixed.html [ Crash ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/col-definite-max-size-001.html [ Crash ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/col-definite-size-001.html [ Crash ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/col-definite-max-size-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/col-definite-size-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/absolute-tables-007.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/absolute-tables-011.tentative.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/absolute-tables-015.html [ ImageOnlyFailure ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
Calc width on col is treated as auto in auto tables


FAIL #theTable 1 assert_equals:
<table id="theTable">
<colgroup><col style="width:calc(20% + 80px)">
</colgroup><tbody><tr>
<td data-expected-width="100"></td>
<td data-expected-width="100"></td>
</tr>
</tbody></table>
width expected 100 but got 0
PASS #theTable 1

13 changes: 9 additions & 4 deletions Source/WebCore/rendering/AutoTableLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
// FIXME: Other browsers have a lower limit for the cell's max width.
const float cCellMaxWidth = 32760;
Length cellLogicalWidth = cell->styleOrColLogicalWidth();
if (cellLogicalWidth.value() > cCellMaxWidth)
cellLogicalWidth.setValue(LengthType::Fixed, cCellMaxWidth);
if (cellLogicalWidth.isNegative())
cellLogicalWidth.setValue(LengthType::Fixed, 0);
if (cellLogicalWidth.isFixed()) {
if (cellLogicalWidth.value() > cCellMaxWidth)
cellLogicalWidth.setValue(LengthType::Fixed, cCellMaxWidth);
if (cellLogicalWidth.isNegative())
cellLogicalWidth.setValue(LengthType::Fixed, 0);
}
switch (cellLogicalWidth.type()) {
case LengthType::Fixed:
// ignore width=0
Expand All @@ -115,6 +117,9 @@ void AutoTableLayout::recalcColumn(unsigned effCol)
if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.percent() > columnLayout.logicalWidth.percent()))
columnLayout.logicalWidth = cellLogicalWidth;
break;
case LengthType::Calculated:
columnLayout.logicalWidth = Length { };
break;
default:
break;
}
Expand Down

0 comments on commit 5d37f68

Please sign in to comment.