Bug 6888

Summary: Collapsed borders appear on the wrong side or on the wrong cell in RTL tables
Product: WebKit Reporter: mitz
Component: TablesAssignee: Nobody <webkit-unassigned>
Status: VERIFIED FIXED    
Severity: Normal Keywords: HasReduction
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 6838    
Attachments:
Description Flags
Testcase
none
Proposed patch
darin: review+
Updated patch darin: review+

Description mitz 2006-01-28 05:11:11 PST
The border-collapsing code assumes that cell 0 is the leftmost and that the last cell is the rightmost, which is wrong for tables with RTL direction. As a result: the table's left border is applied to the left border of the rightmost side and vice versa, and a cell's left border is collapsed with the right border of the cell to its right, and vice versa.
Comment 1 mitz 2006-01-28 05:12:49 PST
Created attachment 6045 [details]
Testcase

Firefox renders this correctly.
Comment 2 mitz 2006-01-28 08:18:40 PST
Created attachment 6050 [details]
Proposed patch
Comment 3 Darin Adler 2006-01-28 16:53:14 PST
Comment on attachment 6050 [details]
Proposed patch

I think it's a little inelegant to have that inLastColumn boolean and those "rtl ? !inLastColumn : (col() > 0)" clauses. Instead, could we just compute an appropriate boolean up front? Something like "righmostColumn" or "leftmostColumn"?

Looks great to me. r=me
Comment 4 mitz 2006-01-29 08:19:15 PST
Created attachment 6072 [details]
Updated patch

Replaced the inLastColumn booleans with leftmostColumn/rightmostColumn per Darin's suggestion.
Comment 5 Darin Adler 2006-01-29 08:52:27 PST
Comment on attachment 6072 [details]
Updated patch

Looks great. I think it's ready to land, but I do have 2 more ideas to improve it. I'll probably just do these if I land it:

    1) cellPrevious and cellNext should be named cellBefore and cellAfter to match the names cellAbove and cellBelow
    2) code to compute leftmostColumn and rightmostColumn should have more closely-matching sides of the if, no need to use an if statement in the RTL case
Comment 6 mitz 2006-01-30 07:07:55 PST
Verified in r12476 nightly