WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
3820
Colspan not working correctly when block type element in <td>
https://bugs.webkit.org/show_bug.cgi?id=3820
Summary
Colspan not working correctly when block type element in <td>
David Storey
Reported
2005-07-02 16:03:27 PDT
This page uses images of rounded corners, in a table to produce the effect of the main area having rounded corners. In safari (at least in 10.3.9) their is a gap after the first image and the right hand side image shows before the end o the nested table inside it. It works as designed in firefox and IE. Reduction forthcoming.
Attachments
a reduction to show problem
(1.53 KB, text/xhtml)
2005-07-02 16:06 PDT
,
David Storey
no flags
Details
Testcase
(790 bytes, text/html)
2005-12-28 01:21 PST
,
Joost de Valk (AlthA)
no flags
Details
Yet another testcase
(205 bytes, text/html)
2006-02-13 15:24 PST
,
Joost de Valk (AlthA)
no flags
Details
rendering in safari, firefox, chrome
(1.11 MB, image/png)
2024-12-01 21:50 PST
,
Karl Dubost
no flags
Details
testcase with colors and borders
(919 bytes, text/html)
2024-12-01 22:04 PST
,
Karl Dubost
no flags
Details
rendering in safari, firefox, chrome (color)
(969.86 KB, image/png)
2024-12-01 22:06 PST
,
Karl Dubost
no flags
Details
testcase with colspan=3
(695 bytes, text/html)
2025-04-17 01:48 PDT
,
Karl Dubost
no flags
Details
rendering in safari, firefox, chrome
(1019.42 KB, image/png)
2025-04-17 01:53 PDT
,
Karl Dubost
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
David Storey
Comment 1
2005-07-02 16:06:14 PDT
Created
attachment 2759
[details]
a reduction to show problem A quick reduction in the source to just show the top rounded corners and a small part of the content area.
Eric Seidel (no email)
Comment 2
2005-12-28 00:11:35 PST
We'll need further reduction. I've browsed through other table layout issues today, which may have been related to this one. Beth re-wrote sections of the table code recently (and continues to do so) she may also have comments on this bug.
Joost de Valk (AlthA)
Comment 3
2005-12-28 01:21:54 PST
Created
attachment 5326
[details]
Testcase This show that this is actually a problem with colspan not doing what it should when a block type element is inside the td.
Beth Dakin
Comment 4
2005-12-29 14:23:29 PST
I remain confused about what this is supposed to look like. The testcase looks wrong on MacIE and Firefox (for the Mac) too. I will need to see what it looks like on WinIE, which I unfortunately can't check right now.
Joost de Valk (AlthA)
Comment 5
2006-02-13 15:24:59 PST
Created
attachment 6470
[details]
Yet another testcase This should show the bug too, open in firefox to see that second td of second row should NOT start half way but way earlier under the div above. Reduced from:
http://www.onlinesoccermanager.nl/info.asp
Joost de Valk (AlthA)
Comment 6
2006-02-13 15:34:19 PST
Changing component to table.
Arpita Bahuguna
Comment 7
2012-09-03 04:09:36 PDT
This issue can perhaps be marked as a duplicate of
https://bugs.webkit.org/show_bug.cgi?id=5515
.
Brent Fulgham
Comment 8
2022-07-06 11:30:45 PDT
We do not match Firefox or Chrome for Table 1.
Radar WebKit Bug Importer
Comment 9
2022-07-06 11:31:00 PDT
<
rdar://problem/96534555
>
Karl Dubost
Comment 10
2024-12-01 21:50:31 PST
Created
attachment 473410
[details]
rendering in safari, firefox, chrome ``` Safari Technology Preview 208 20621.1.5.1 Firefox Nightly 135.0a1 13524.11.25 Google Chrome Canary 133.0.6871.0 6871.0 ```
Karl Dubost
Comment 11
2024-12-01 22:04:56 PST
Created
attachment 473411
[details]
testcase with colors and borders Adding another test case to better see what is happenning.
Karl Dubost
Comment 12
2024-12-01 22:06:57 PST
Created
attachment 473412
[details]
rendering in safari, firefox, chrome (color) testcase color rendering
Karl Dubost
Comment 13
2024-12-01 22:10:31 PST
It's like the second row first cell is trying to take half of the space of the colspan of the first row. while in firefox and chrome the first cell is reduced to its minimum width. even a fit-content or min-content on this would not work.
Karl Dubost
Comment 14
2025-04-17 01:31:36 PDT
for example in the first table on my current layout. Element Margin Border Padding Width (comment) TABLE 0 1 0 826 TBODY 0 0 0 826 TR 0 0 0 826 TD 0 1 1 818 (colspan = 2) DIV 0 0 0 100 TR 0 0 0 826 TD 0 1 1 47 (total size 1+1+47+1+1 = 51 which is almost half of the DIV) TD 0 1 1 765 (width=100%) if I set the DIV to be 200px Then the TD of the second row is TD 0 1 1 97 (97 + 4 = 101) again the same type of proportion. Currently:
https://searchfox.org/wubkat/rev/5df2953b4ca7158afd166f3f8c130d1a8888cf0f/Source/WebCore/rendering/RenderTableCellInlines.h#66-74
```cpp inline Length RenderTableCell::styleOrColLogicalWidth() const { Length styleWidth = style().logicalWidth(); if (!styleWidth.isAuto()) return styleWidth; if (RenderTableCol* firstColumn = table()->colElement(col())) return logicalWidthFromColumns(firstColumn, styleWidth); return styleWidth; } ``` and
https://searchfox.org/wubkat/rev/5df2953b4ca7158afd166f3f8c130d1a8888cf0f/Source/WebCore/rendering/RenderTableCell.cpp#167-197
```cpp Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const { ASSERT(firstColForThisCell && firstColForThisCell == table()->colElement(col())); RenderTableCol* tableCol = firstColForThisCell; unsigned colSpanCount = colSpan(); LayoutUnit colWidthSum; for (unsigned i = 1; i <= colSpanCount; i++) { Length colWidth = tableCol->style().logicalWidth(); // Percentage value should be returned only for colSpan == 1. // Otherwise we return original width for the cell. if (!colWidth.isFixed()) { if (colSpanCount > 1) return widthFromStyle; return colWidth; } colWidthSum += colWidth.value(); tableCol = tableCol->nextColumn(); // If no next <col> tag found for the span we just return what we have for now. if (!tableCol) break; } // Column widths specified on <col> apply to the border box of the cell, see
bug 8126
. // FIXME: Why is border/padding ignored in the negative width case? if (colWidthSum > 0) return Length(std::max<LayoutUnit>(0, colWidthSum - borderAndPaddingLogicalWidth()), LengthType::Fixed); return Length(colWidthSum, LengthType::Fixed); } ```
Karl Dubost
Comment 15
2025-04-17 01:48:27 PDT
Created
attachment 474939
[details]
testcase with colspan=3 This testcase will make it easier to understand. <table> <tr> <td colspan="3"> <div style="background-color: gold; width: 100px; height: 100px;"></div> </td> </tr> <tr> <td></td> <td></td> <td style="background-color: pink" width="100%"></td> </tr> </table>
Karl Dubost
Comment 16
2025-04-17 01:53:01 PDT
Created
attachment 474940
[details]
rendering in safari, firefox, chrome What is happening in Safari is a bit clearer. 1. It computes the width of the second TR depending on the size of the element contained in the first TR (which is 100px) 2. Then distribute equally the space in between the 3 cells of the second row. 3. Then realizes there is still space aka the TR is a lot wider, and stretches the last cell which is width 100% to the full remaining space of the TR. I wonder why the width of the first column stays 100px with the colspan=3 and why it is being reused later something to dig there.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug