Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
index f4681d9d0e785dc840cb607ee76a055d8a595ab2..c513b07c7b49d4b3c72eb19c6875d14b0fe21a22 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
@@ -943,6 +943,7 @@ void LayoutTableSection::layout() { |
LayoutState state(*this, locationOffset()); |
const Vector<int>& columnPos = table()->effectiveColumnPositions(); |
+ LayoutUnit rowLogicalTop; |
SubtreeLayoutScope layouter(*this); |
for (unsigned r = 0; r < m_grid.size(); ++r) { |
@@ -970,9 +971,18 @@ void LayoutTableSection::layout() { |
} |
if (LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject) { |
- if (!rowLayoutObject->needsLayout()) |
- markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter); |
+ if (state.isPaginated()) { |
+ rowLayoutObject->setLogicalTop(rowLogicalTop); |
+ if (!rowLayoutObject->needsLayout()) |
+ markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter); |
+ } |
rowLayoutObject->layoutIfNeeded(); |
+ if (state.isPaginated()) { |
+ rowLayoutObject->setLogicalHeight( |
+ LayoutUnit(logicalHeightForRow(*rowLayoutObject))); |
+ rowLogicalTop = rowLayoutObject->logicalBottom(); |
+ rowLogicalTop += LayoutUnit(table()->vBorderSpacing()); |
+ } |
} |
} |
@@ -1975,6 +1985,27 @@ void LayoutTableSection::relayoutCellIfFlexed(LayoutTableCell& cell, |
} |
} |
+int LayoutTableSection::logicalHeightForRow( |
+ const LayoutTableRow& rowObject) const { |
+ unsigned rowIndex = rowObject.rowIndex(); |
+ int logicalHeight = 0; |
+ const Row& row = m_grid[rowIndex].row; |
+ unsigned cols = row.size(); |
+ for (unsigned colIndex = 0; colIndex < cols; colIndex++) { |
+ const CellStruct& cellStruct = cellAt(rowIndex, colIndex); |
+ const LayoutTableCell* cell = cellStruct.primaryCell(); |
+ if (!cell || cellStruct.inColSpan) |
+ continue; |
+ // TODO(mstensho): Rowspanned cells also need to contribute to row heights |
+ // during the first layout pass, in order to get fragmentation right. |
+ if (cell->rowSpan() == 1) { |
+ logicalHeight = |
+ std::max(logicalHeight, cell->logicalHeightForRowSizing()); |
+ } |
+ } |
+ return logicalHeight; |
+} |
+ |
bool LayoutTableSection::isRepeatingHeaderGroup() const { |
if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks) |
return false; |