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 94d4263d1d2d338a29a17a9e2ea44cd9f0a5dbd5..d9469e4bef905d92aab91512919affe7063c14d6 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
@@ -1102,7 +1102,8 @@ void LayoutTableSection::layoutRows() { |
paginationStrutOnRow = |
paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r])); |
rowLayoutObject->setPaginationStrut(LayoutUnit(paginationStrutOnRow)); |
- if (paginationStrutOnRow) { |
+ if (paginationStrutOnRow || |
+ needsStrutForTableHeaders(state, LayoutUnit(m_rowPos[r]))) { |
// If there isn't room for at least one content row on a page with a header group, then |
// we won't repeat the header on each page. |
if (!r && table()->header() && |
@@ -1267,8 +1268,16 @@ int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, |
LayoutUnit rowLogicalHeight = row->logicalHeight(); |
if (rowLogicalHeight > pageLogicalHeight) |
return 0; |
+ |
LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset( |
logicalOffset, LayoutBlock::AssociateWithLatterPage); |
+ LayoutUnit offsetForBorderSpacing = |
+ pageLogicalHeight - (remainingLogicalHeight + table()->vBorderSpacing()); |
+ // Border spacing from the previous row has pushed this row just past the top of the page, so we must reposition it to the top |
mstensho (USE GERRIT)
2016/10/04 21:02:38
Should wrap this comment at 80 cols.
|
+ // of the page and avoid any repeating header. |
+ if (offsetForBorderSpacing < 0) |
+ return offsetForBorderSpacing.toInt(); |
+ |
if (remainingLogicalHeight >= rowLogicalHeight) |
return 0; // It fits fine where it is. No need to break. |
LayoutUnit paginationStrut = calculatePaginationStrutToFitContent( |