Skip to content

Commit 46e3444

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
[Tables] Fix baseline handling by skipping adjustments when cell has no inflow children
https://bugs.webkit.org/show_bug.cgi?id=298659 rdar://problem/160774504 Reviewed by Alan Baradlay. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Inspired by: https://chromium.googlesource.com/chromium/src/+/ca5380c68d5805f2e7ae6914620723fed797685c According to Web Specification [1], the baseline of a table cell is the baseline of the first in-flow line box or table-row, whichever comes first. If none exist, the baseline falls back to the bottom content edge of the cell box. WebKit previously always attempted to adjust intrinsic padding during baseline alignment, even for cells containing only out-of-flow (OOF) children. However, the specification distinguishes between: - Baseline determination (always produced, falling back to content edge if needed) - Baseline alignment adjustments (only applied when in-flow children exist) This patch adds an in-flow child check in `applyStandard` to ensure that intrinsic padding adjustments are skipped for cells with only OOF children. In such cases, the baseline defaults to the content edge without applying any padding shift. The check uses `firstInFlowChild()` for efficiency, and the baseline computation is deferred until after this check to avoid unnecessary calculations when early-returning. This patch fixes WebKit's behavior and makes it consistent with other browsers and closer to the web specification. [1] https://www.w3.org/TR/CSS21/tables.html#height-layout * Source/WebCore/rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::computeIntrinsicPadding): > Progression: * LayoutTests/TestExpectations: > Rebaselines: * LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt: * LayoutTests/platform/glib/fast/css/acid2-expected.txt: * LayoutTests/platform/glib/fast/css/acid2-pixel-expected.txt: * LayoutTests/platform/glib/fast/dynamic/insert-before-table-part-in-continuation-expected.txt: * LayoutTests/platform/glib/http/tests/misc/acid2-expected.txt: * LayoutTests/platform/glib/http/tests/misc/acid2-pixel-expected.txt: * LayoutTests/platform/ios/fast/css/acid2-expected.txt: * LayoutTests/platform/ios/fast/css/acid2-pixel-expected.txt: * LayoutTests/platform/ios/fast/dynamic/insert-before-table-part-in-continuation-expected.txt: * LayoutTests/platform/ios/http/tests/misc/acid2-expected.txt: * LayoutTests/platform/ios/http/tests/misc/acid2-pixel-expected.txt: * LayoutTests/platform/mac/fast/css/acid2-expected.txt: * LayoutTests/platform/mac/fast/css/acid2-pixel-expected.txt: * LayoutTests/platform/mac/fast/dynamic/insert-before-table-part-in-continuation-expected.txt: * LayoutTests/platform/mac/http/tests/misc/acid2-expected.txt: * LayoutTests/platform/mac/http/tests/misc/acid2-pixel-expected.txt: Canonical link: https://commits.webkit.org/304477@main
1 parent 25c05d9 commit 46e3444

18 files changed

+35
-30
lines changed

LayoutTests/TestExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6734,7 +6734,6 @@ imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-si
67346734
imported/w3c/web-platform-tests/css/css-tables/height-distribution/percentage-sizing-of-table-cell-children-006.html [ ImageOnlyFailure ]
67356735
imported/w3c/web-platform-tests/css/css-tables/min-max-size-table-content-box.html [ ImageOnlyFailure ]
67366736
imported/w3c/web-platform-tests/css/css-tables/rules-groups.html [ ImageOnlyFailure ]
6737-
imported/w3c/web-platform-tests/css/css-tables/table-cell-baseline-static-position.html [ ImageOnlyFailure ]
67386737
imported/w3c/web-platform-tests/css/css-tables/table-has-box-sizing-border-box-002.html [ ImageOnlyFailure ]
67396738
imported/w3c/web-platform-tests/css/css-tables/tentative/paint/background-image-column-collapsed.html [ ImageOnlyFailure ]
67406739
imported/w3c/web-platform-tests/css/css-tables/tentative/paint/background-image-column.html [ ImageOnlyFailure ]

LayoutTests/fast/table/table-insert-before-non-anonymous-block-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ layer at (0,0) size 800x466
5353
RenderTableCell (anonymous) at (0,0) size 50x100 [r=0 c=0 rs=1 cs=1]
5454
RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#0000FF]
5555
RenderBlock {DIV} at (0,50) size 50x50 [bgcolor=#0000FF]
56-
RenderTableCell {DIV} at (50,50) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]
56+
RenderTableCell {DIV} at (50,0) size 50x0 [bgcolor=#0000FF] [r=0 c=1 rs=1 cs=1]

LayoutTests/platform/glib/fast/css/acid2-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,2638) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,2842) size 740x10 scrollHeight 276

LayoutTests/platform/glib/fast/css/acid2-pixel-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,72) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,276) size 740x10 scrollHeight 276

LayoutTests/platform/glib/fast/dynamic/insert-before-table-part-in-continuation-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ layer at (0,0) size 800x600
4040
RenderTable at (39,0) size 104x18
4141
RenderTableSection (anonymous) at (0,0) size 103x18
4242
RenderTableRow (anonymous) at (0,0) size 103x18
43-
RenderTableCell {TD} at (0,14) size 0x0 [r=0 c=0 rs=1 cs=1]
43+
RenderTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1]
4444
RenderTableCell {DIV} at (0,0) size 103x18 [r=0 c=1 rs=1 cs=1]
4545
RenderText {#text} at (0,0) size 103x17
4646
text run at (0,0) width 103: "...continues here"

LayoutTests/platform/glib/http/tests/misc/acid2-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,2638) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,2842) size 740x10 scrollHeight 276

LayoutTests/platform/glib/http/tests/misc/acid2-pixel-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,72) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,276) size 740x10 scrollHeight 276

LayoutTests/platform/ios/fast/css/acid2-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,2640) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,2844) size 740x10 scrollHeight 277

LayoutTests/platform/ios/fast/css/acid2-pixel-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ layer at (36,72) size 764x226
3333
RenderTable {UL} at (96,192) size 48x12 [bgcolor=#FF0000]
3434
RenderTableSection (anonymous) at (0,0) size 48x12
3535
RenderTableRow (anonymous) at (0,0) size 48x12
36-
RenderTableCell {LI} at (0,12) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
36+
RenderTableCell {LI} at (0,0) size 12x0 [bgcolor=#000000] [r=0 c=0 rs=1 cs=1]
3737
RenderTableCell (anonymous) at (12,0) size 12x12 [r=0 c=1 rs=1 cs=1]
3838
RenderTable {LI} at (0,0) size 12x12 [bgcolor=#000000]
39-
RenderTableCell {LI} at (24,12) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
39+
RenderTableCell {LI} at (24,0) size 12x0 [bgcolor=#000000] [r=0 c=2 rs=1 cs=1]
4040
RenderTableCell (anonymous) at (36,0) size 12x12 [r=0 c=3 rs=1 cs=1]
4141
RenderListItem {LI} at (0,0) size 12x12 [bgcolor=#000000]
4242
layer at (48,276) size 740x10 scrollHeight 277

LayoutTests/platform/ios/fast/dynamic/insert-before-table-part-in-continuation-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ layer at (0,0) size 800x600
4040
RenderTable at (40,0) size 106x20
4141
RenderTableSection (anonymous) at (0,0) size 105x20
4242
RenderTableRow (anonymous) at (0,0) size 105x20
43-
RenderTableCell {TD} at (0,15) size 0x0 [r=0 c=0 rs=1 cs=1]
43+
RenderTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1]
4444
RenderTableCell {DIV} at (0,0) size 105x20 [r=0 c=1 rs=1 cs=1]
4545
RenderText {#text} at (0,0) size 105x19
4646
text run at (0,0) width 105: "...continues here"

0 commit comments

Comments
 (0)