2006-05-25  Mitz Pettel  <opendarwin.org@mitzpettel.com>

        Reviewed by hyatt.  Landed by eseidel.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3297
          height property is not honored on table rows

        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::addChild): Assign the row renderer to the
        grid row.
        (WebCore::RenderTableSection::calcRowHeight): Fix off-by-one index bug
        and add vertical spacing only for grid rows that have a renderer.
        (WebCore::RenderTableSection::recalcCells): Assign row renderers to
        grid rows.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index 8728f38..44985b3 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -127,6 +127,7 @@
     cCol = 0;
 
     ensureRows(cRow + 1);
+    grid[cRow].rowRenderer = child;
 
     if (!beforeChild) {
         grid[cRow].height = child->style()->height();
@@ -295,7 +296,7 @@
         int baseline = 0;
         int bdesc = 0;
         int ch = grid[r].height.calcMinValue(0);
-        int pos = rowPos[r + 1] + ch + spacing;
+        int pos = rowPos[r] + ch + (grid[r].rowRenderer ? spacing : 0);
 
         if (pos > rowPos[r + 1])
             rowPos[r + 1] = pos;
@@ -329,7 +330,7 @@
             if (cell->height() > ch)
                 ch = cell->height();
 
-            pos = rowPos[ indx ] + ch + spacing;
+            pos = rowPos[indx] + ch + (grid[r].rowRenderer ? spacing : 0);
 
             if (pos > rowPos[r + 1])
                 rowPos[r + 1] = pos;
@@ -353,7 +354,7 @@
         //do we have baseline aligned elements?
         if (baseline) {
             // increase rowheight if baseline requires
-            int bRowPos = baseline + bdesc  + spacing ; // + 2*padding
+            int bRowPos = baseline + bdesc + (grid[r].rowRenderer ? spacing : 0);
             if (rowPos[r + 1] < bRowPos)
                 rowPos[r + 1] = bRowPos;
 
@@ -941,6 +942,8 @@
             cRow++;
             cCol = 0;
             ensureRows(cRow + 1);
+            grid[cRow].rowRenderer = row;
+
             for (RenderObject *cell = row->firstChild(); cell; cell = cell->nextSibling())
                 if (cell->isTableCell())
                     addCell(static_cast<RenderTableCell *>(cell), row);