Skip to content

Commit 3ea149a

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
Fix table layout to properly handle visibility:collapse on columns
https://bugs.webkit.org/show_bug.cgi?id=305905 rdar://168556786 Reviewed by Alan Baradlay. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Columns with visibility:collapse should not contribute to table width calculations. This patch modifies AutoTableLayout to: 1. Skip collapsed columns in recalcColumn() by setting their min/max widths to 0 early. 2. Skip collapsed columns throughout layout() when distributing available width to columns. 3. Skip adding border-spacing after collapsed columns when calculating column positions. Previously, collapsed columns were treated as normal columns and received width allocation, causing tables to be wider than expected. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-003-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-004-dynamic-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-005-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-colspan-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-rowcol-001-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-rowcol-002-expected.txt: * LayoutTests/platform/glib/tables/mozilla_expected_failures/other/test4-expected.txt: * LayoutTests/platform/ios/tables/mozilla_expected_failures/other/test4-expected.txt: * LayoutTests/platform/mac/tables/mozilla_expected_failures/other/test4-expected.txt: * Source/WebCore/rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::layout): Canonical link: https://commits.webkit.org/305997@main
1 parent 9a74e87 commit 3ea149a

File tree

13 files changed

+322
-251
lines changed

13 files changed

+322
-251
lines changed

LayoutTests/TestExpectations

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7883,8 +7883,6 @@ http/tests/iframe-memory-monitor/video-iframe.html [ Skip ]
78837883
# css/CSS2/tables failures
78847884
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-collapse-006.html [ ImageOnlyFailure ]
78857885
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-collapse-dynamic-column-002.xht [ ImageOnlyFailure ]
7886-
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-collapse-visibility-collapse-001.tentative.html [ ImageOnlyFailure ]
7887-
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-collapse-visibility-collapse-002.tentative.html [ ImageOnlyFailure ]
78887886
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-conflict-element-001d.xht [ ImageOnlyFailure ]
78897887
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/border-conflict-element-001e.xht [ ImageOnlyFailure ]
78907888
webkit.org/b/288957 imported/w3c/web-platform-tests/css/CSS2/tables/caption-position-001.xht [ ImageOnlyFailure ]

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-001-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ row 2
1212
row 3
1313

1414
PASS col visibility:collapse doesn't change table height
15-
FAIL col visibility:collapse changes table width assert_equals: expected 116 but got 222
15+
PASS col visibility:collapse changes table width
1616

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-002-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ row 2
1212
row 3
1313

1414
PASS col visibility:collapse doesn't change table height
15-
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 10 but got 222
15+
PASS col visibility:collapse changes table width
1616

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-003-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ row 2
1212
row 3
1313

1414
PASS col visibility:collapse doesn't change table height
15-
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 116 but got 222
15+
PASS col visibility:collapse changes table width
1616

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-004-dynamic-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ row 2
88
row 3
99

1010
PASS col visibility:collapse doesn't change table height
11-
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 122 but got 232
11+
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 122 but got 124
1212

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-col-005-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Setting a spanning column to visibility:collapse changes table width but not hei
55

66

77
PASS col visibility:collapse doesn't change table height
8-
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 100 but got 111
8+
PASS col visibility:collapse changes table width
99

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-colspan-002-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Setting a spanning column to visibility:collapse changes table width but not hei
55

66

77
PASS col visibility:collapse doesn't change table height
8-
FAIL col visibility:collapse changes table width assert_equals: col visibility:collapse changes table width expected 50 but got 60
8+
PASS col visibility:collapse changes table width
99

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-rowcol-001-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Spec
44
Setting row and column to visibility:collapse changes both height and width. The collapsed result should have whitespace in the bottom right corner.
55

66

7-
FAIL spanning col visibility:collapse changes table width assert_equals: spanning col visibility:collapse changes table width expected 112 but got 148
7+
FAIL spanning col visibility:collapse changes table width assert_equals: spanning col visibility:collapse changes table width expected 112 but got 114
88
PASS spanning row visibility:collapse changes height
99

LayoutTests/imported/w3c/web-platform-tests/css/css-tables/visibility-collapse-rowcol-002-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Spec
44
Setting row and spanning column to visibility:collapse changes height and width.
55

66

7-
FAIL spanning row visibility:collapse doesn't change table width assert_equals: spanning row visibility:collapse doesn't change table width expected 45 but got 130
7+
PASS spanning row visibility:collapse doesn't change table width
88
PASS spanning row visibility:collapse doesn't change height in this case
99

LayoutTests/platform/glib/tables/mozilla_expected_failures/other/test4-expected.txt

Lines changed: 86 additions & 80 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)