Bug 15882

Summary: Padding on table cells off by one
Product: WebKit Reporter: Marcus Better <marcus>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: rendezvouscp, webkit
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Test case
none
Result with WebKit r27433 none

Description Marcus Better 2007-11-07 05:42:30 PST
If a TD element has a top and/or bottom padding, the total height of the cell seems to be off by one. The border box of the cell decreases by 1px for each edge that has padding applied to it, regardless of the size of the padding.
Comment 1 Marcus Better 2007-11-07 05:43:01 PST
Created attachment 17108 [details]
Test case
Comment 2 Marcus Better 2007-11-07 05:43:53 PST
Created attachment 17109 [details]
Result with WebKit r27433

The right- and leftmost boxes are one pixel smaller than the middle one.
Comment 3 Chasen Le Hara 2008-02-04 23:40:51 PST
Confirmed on nightly r29955.
Comment 4 Robert Blaut 2008-02-05 06:34:28 PST
Marcus, you assume that td have initially padding set to 0, but it isn't true in this case. After initializing "td {padding: 0}" the test case works as expected. You should notice, that every browser have implemented its own default style sheet. http://www.w3.org/TR/CSS21/sample.html have example of such style sheet. However above mentioned example is *informative*, not *normative* so implementators are not obligated to use it. It looks that Webkit uses small default padding set to 1px for td.

In this case, for me, the bug is INVALID, but I would like to see final decision made by more experienced Webkit developer. 

PS. The test case fails completely in Firefox and Opera.
Comment 5 Marcus Better 2008-02-05 06:56:18 PST
(In reply to comment #4)
> Marcus, you assume that td have initially padding set to 0, but it isn't 
> true in this case.

Seems you are right. Besides the test case is in content-box mode so I don't see why the boxes should be the same height at all.
Comment 6 Robert Blaut 2008-02-05 07:10:47 PST
(In reply to comment #5) 
> Seems you are right. Besides the test case is in content-box mode so I don't
> see why the boxes should be the same height at all.

I assume that td is initialized with padding: 0 and borders are set to 0. So computed "visible" height of td is:

table 1: 5px + 95px+0px = 100px
table 2: 0px + 100px + 0px = 100px
table 3: 0px + 95px + 5px = 100px