Bug 18565

Summary: table-layout:fixed computes wrong cell width ignoring border width
Product: WebKit Reporter: Alan Tam <Tam>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: andy_murdoch, bryan, danjwilson, marcoos+bwo, phnixwxz, robert, robin, ryan, tatham, wangxianzhu
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 78412    
Bug Blocks:    
Attachments:
Description Flags
reduction
none
How the testcase is rendered in WebKit, Gecko and Opera none

Description Alan Tam 2008-04-17 21:33:04 PDT
If a table has both "table-layout: fixed" and "width: 0", then cells with borders have wrong width.
This occurs in both safari 3.x mac&win and linux svn 31841 (debian sid).
The expected behavior is rendered by IE6, IE7, Firefox 2, Firefox 3 beta and Opera 9.2.

Consider a table with 3 columns, all with width 200px.
If one of the cells have "border-left: 50px; width: 150px;",
then according to the rules of "table-layout: fixed", the cell should still have width 200px.
But webkit renders the cell with only width 150px.
Comment 1 Alan Tam 2008-04-17 21:34:39 PDT
Created attachment 20658 [details]
reduction

reduction
Comment 2 Marek Stepien 2009-07-20 15:13:54 PDT
I can confirm this in the following browsers:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-US) AppleWebKit/531.5 (KHTML, like Gecko) Chrome/3.0.194 Safari/531.5

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; pl-pl) AppleWebKit/532.0+ (KHTML, like Gecko) Version/4.0.2 Safari/530.19

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; pl-pl) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19

I am also pretty sure it was also reproducible in earlier WebKit builds, as I remember having to work around this on one of the sites I made.
Comment 3 Marek Stepien 2009-07-20 15:21:13 PDT
Note that what comment 0 says about the width needing to be 0 is not actually needed -- any width other than the default value of auto triggers this problem.

You can change "width:0" to "width: 600px" in attachment 20658 [details] and still see the issue.
Comment 4 Marek Stepien 2009-07-20 15:23:41 PDT
Created attachment 33114 [details]
How the testcase is rendered in WebKit, Gecko and Opera

From top: Firefox 3.5, Opera 10alpha, today's WebKit nightly.
Comment 5 Marek Stepien 2009-07-21 01:25:42 PDT
Also, IE 7 and 8 render it exactly the same as Gecko and Opera.
Comment 6 Tatham Oddie 2010-02-03 13:53:35 PST
Suspected duplicate of bug 18565.
Comment 7 Tatham Oddie 2010-02-03 13:54:31 PST
Suspected duplicate of bug 13339.
Comment 8 ryan beal 2010-07-29 11:21:34 PDT
I'm having a similar issue but with the padding.
table
{
 table-layout:fixed;
}
td
{
 width:70px;
 padding:0 4px;
}

Expected Results: cell with a 70px content box and a 78px padding box.
Browsers with expected results: IE 6, 7, 8. FF 2, 3. Opera 10.

Webkit browser (chrome, safari) Results: cell with a 62px content box and a 70px padding box.

Page with issue (this page should be live for awhile):
http://www.maxpreps.com/testing/reference_for_webkit_team_regarding_table_bug.htm
Comment 9 Bryan Forbes 2011-04-20 20:15:17 PDT
This seems to be a border-box vs. content-box issue and WebKit is putting fixed layout cells into border-box mode. I have created a fiddle at http://jsfiddle.net/bryanforbes/uuwy5/ which demonstrates that even trying to force TD's into content-box mode with "-webkit-box-sizing: content-box;" fails.
Comment 10 Marek Stepien 2012-03-30 03:10:33 PDT
This has been fixed by fixing bug 78412.
Comment 11 Robert Hogan 2012-03-30 11:00:55 PDT

*** This bug has been marked as a duplicate of bug 78412 ***