[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs=5D_khtml/rendering=3A_Fix_serious_regressio?=
From:       Allan Sandfeld Jensen <kde () carewolf ! com>
Date:       2011-03-28 14:58:29
Message-ID: 20110328145829.8BEB3A609B () git ! kde ! org
[Download RAW message or body]

Git commit 3075d7bb19cdf5f3e546c3919e38e01482430182 by Allan Sandfeld Jensen.
Committed on 28/03/2011 at 16:38.
Pushed by carewolf into branch 'master'.

Fix serious regression in table printing

Old behavior restored after RenderRow has gotten their own coordinates.
BUG:259163
BUG:190071

M  +13   -20   khtml/rendering/render_table.cpp     

http://commits.kde.org/kdelibs/3075d7bb19cdf5f3e546c3919e38e01482430182

diff --git a/khtml/rendering/render_table.cpp b/khtml/rendering/render_table.cpp
index a72672e..ac703ef 100644
--- a/khtml/rendering/render_table.cpp
+++ b/khtml/rendering/render_table.cpp
@@ -7,7 +7,7 @@
  *           (C) 1999-2003 Lars Knoll (knoll@kde.org)
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2003 Apple Computer, Inc.
- *           (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
+ *           (C) 2005,2011 Allan Sandfeld Jensen (kde@carewolf.com)
  *           (C) 2008 Germain Garand (germain@ebooksfrance.org)
  *           (C) 2009 Carlos Licea (carlos.licea@kdemail.net)
  *
@@ -2017,25 +2017,13 @@ void RenderTableSection::addSpaceAt(int pos, int dy)
     const int nEffCols = table()->numEffCols();
     const int totalRows = numRows();
     for ( int r = 0; r < totalRows; r++ ) {
-        if (rowPos[r] >= pos) {
+        if (rowPos[r] > pos) {
             rowPos[r] += dy;
-            int rindx;
-            for ( int c = 0; c < nEffCols; c++ )
-            {
-                RenderTableCell *cell = cellAt(r, c);
-                if (!cell || cell == (RenderTableCell *)-1 )
-                    continue;
-                if ( r > 0 && cell == cellAt(r-1, c) )
-                    continue;
-
-                if ( ( rindx = r-cell->rowSpan()+1 ) < 0 )
-                    rindx = 0;
-
-                cell->setPos(cell->xPos(), rowPos[r]);
-            }
+	    if (grid[r].rowRenderer)
+		grid[r].rowRenderer->setPos(0, rowPos[r]);
         }
     }
-    if (rowPos[totalRows] >= pos)
+    if (rowPos[totalRows] > pos)
         rowPos[totalRows] += dy;
     m_height = rowPos[totalRows];
 
@@ -2298,8 +2286,13 @@ void RenderTableRow::layout()
                 cell->setNeedsLayout(true);
                 int oldHeight = child->height();
                 cell->layout();
-                if (oldHeight > 0 && child->containsPageBreak() && child->height() != oldHeight)
-                    section()->addSpaceAt(child->yPos()+1, child->height() - oldHeight);
+                if (oldHeight > 0 && child->containsPageBreak() && child->height() != oldHeight) {
+		    // child has grown to accomodate a page-page, grow the same amount ourselves, 
+		    // and shift following rows down without relayouting the entire table
+		    int adjust = child->height() - oldHeight;
+		    setHeight(height()+adjust);
+                    section()->addSpaceAt(yPos()+1, adjust);
+		}
             } else
             if ( child->needsLayout() ) {
                 if (markedForRepaint())
@@ -2547,7 +2540,7 @@ void RenderTableCell::repaintRectangle(int x, int y, int w, int h, Priority p, b
 
 int RenderTableCell::pageTopAfter(int y) const
 {
-    return section()->pageTopAfter(y+m_y + _topExtra) - (m_y  + _topExtra);
+    return parent()->pageTopAfter(y+m_y + _topExtra) - (m_y  + _topExtra);
 }
 
 short RenderTableCell::baselinePosition( bool ) const

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic