Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2422163003: Account for border spacing correctly when repeating header groups (Closed)
Patch Set: Account for border spacing correctly when repeating header groups Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 cf4ca8bf69e781bf1af27e11d0421defc1563460..533a6fa87a8cd31ebcd23397eda10ee2e811f565 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1246,14 +1246,6 @@ int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row,
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 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(
@@ -1998,12 +1990,18 @@ void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject,
rowObject.setLogicalHeight(LayoutUnit(logicalHeightForRow(rowObject)));
int paginationStrut =
paginationStrutForRow(&rowObject, rowObject.logicalTop());
+ bool rowIsAtTopOfColumn = false;
+ LayoutUnit offsetFromTopOfPage;
if (!paginationStrut) {
- bool rowIsAtTopOfColumn =
- state.heightOffsetForTableHeaders() &&
- pageLogicalHeightForOffset(rowObject.logicalTop()) ==
- pageRemainingLogicalHeightForOffset(rowObject.logicalTop(),
- AssociateWithLatterPage);
+ if (state.heightOffsetForTableHeaders()) {
+ offsetFromTopOfPage =
+ pageLogicalHeightForOffset(rowObject.logicalTop()) -
+ pageRemainingLogicalHeightForOffset(rowObject.logicalTop(),
+ AssociateWithLatterPage);
+ rowIsAtTopOfColumn = !offsetFromTopOfPage ||
+ offsetFromTopOfPage <= table()->vBorderSpacing();
+ }
+
if (!rowIsAtTopOfColumn)
return;
}
@@ -2021,6 +2019,12 @@ void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject,
state.setHeightOffsetForTableHeaders(state.heightOffsetForTableHeaders() -
header->logicalHeight());
}
+ // 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 of the page and avoid any
+ // repeating header.
+ if (rowIsAtTopOfColumn && offsetFromTopOfPage)
+ paginationStrut -= offsetFromTopOfPage.toInt();
+
// If we have a header group we will paint it at the top of each page,
// move the rows down to accomodate it.
paginationStrut += state.heightOffsetForTableHeaders().toInt();
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-with-border-spacing-at-top-of-row-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698