Regression from border-collapsing

David Hyatt hyatt at apple.com
Mon Oct 20 00:58:47 CEST 2003


I screwed up my implementation of collapsed right borders on cells with 
colspans.  This caused a crash on tivocommunity.com.

Fix:

-------------- next part --------------
Index: khtml/rendering/render_table.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.79
diff -u -p -r1.79 khtml/rendering/render_table.cpp
--- khtml/rendering/render_table.cpp	2003/10/17 22:32:14	1.79
+++ khtml/rendering/render_table.cpp	2003/10/20 02:26:25
@@ -810,10 +810,11 @@ RenderTableCell* RenderTable::cellLeft(c
 
 RenderTableCell* RenderTable::cellRight(const RenderTableCell* cell) const
 {
-    int effCol = colToEffCol(cell->col());
+    int effCol = colToEffCol(cell->col()+cell->colSpan());
     if (effCol == numEffCols()-1)
         return 0;
-    return cell->section()->cellAt(cell->row(), effCol+1);
+    RenderTableCell* result = cell->section()->cellAt(cell->row(), effCol);
+    return (result == (RenderTableCell*)-1) ? 0 : result;
 }
 
 #ifndef NDEBUG
@@ -1800,7 +1801,7 @@ CollapsedBorderValue RenderTableCell::co
 {
     RenderTable* tableElt = table();
     bool inLastColumn = false;
-    int effCol = tableElt->colToEffCol(col());
+    int effCol = tableElt->colToEffCol(col()+colSpan()-1);
     if (effCol == tableElt->numEffCols()-1)
         inLastColumn = true;
     
@@ -1827,7 +1828,7 @@ CollapsedBorderValue RenderTableCell::co
     }
     
     // (5) Our column's right border.
-    RenderTableCol* colElt = table()->colElement(col());
+    RenderTableCol* colElt = table()->colElement(col()+colSpan()-1);
     if (colElt) {
         result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderRight(), BCOL));
         if (!result.exists()) return result;
@@ -1835,7 +1836,7 @@ CollapsedBorderValue RenderTableCell::co
     
     // (6) The next column's left border.
     if (!inLastColumn) {
-        colElt = tableElt->colElement(col()+1);
+        colElt = tableElt->colElement(col()+colSpan());
         if (colElt) {
             result = compareBorders(result, CollapsedBorderValue(&colElt->style()->borderLeft(), BCOL));
             if (!result.exists()) return result;
-------------- next part --------------


dave


More information about the Khtml-devel mailing list