      // If any table section moved vertically, we will just repaint everything from that
      // section down (it is quite unlikely that any of the following sections
      // did not shift).
-@@ -361,12 +383,6 @@ void RenderTable::layout()
+@@ -361,12 +387,6 @@ void RenderTable::layout()
          computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLength);
      computedLogicalHeight = max(0, computedLogicalHeight);
  

                 // find actual end of table on current page
                 int dy = 0;
                 const int max_dy = info.rect.y() + info.rect.height();
@@ -1291,4 +1310,4 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu
     return false;
 }
 
-}
+}
\ No newline at end of file
diff --git a/src/qt/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp b/src/qt/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp
index 1e90ac6..b41db29 100644
--- a/src/qt/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/src/qt/src/3rdparty/webkit/Source/WebCore/rendering/RenderTableSection.cpp
@@ -496,23 +496,34 @@ int RenderTableSection::layoutRows(int toAdd, int headHeight, int footHeight)
 
     LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());
 

+            }
+            if (m_firstBody) {
+                // FIXME: Calculate maximum required height across all cells in first body row
+                if (m_firstBody->numRows() > 0 && m_firstBody->numColumns() > 0) {
+                    RenderTableCell* firstCell = m_firstBody->primaryCellAt(0, 0);
+                    if (firstCell) {
+                        requiredHeight += firstCell->contentLogicalHeight() + firstCell->paddingTop(false) + firstCell->paddingBottom(false) + vBorderSpacing();
+                    }
+                }
+            }
+            if (requiredHeight > remainingLogicalHeight) {
+                setPaginationStrut(remainingLogicalHeight);
