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

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

Issue 2422163003: Account for border spacing correctly when repeating header groups (Closed)
Patch Set: bug 642814 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 25fb70ab90f774205c1b74dae700f9f6112bb61c..cef034176dbc021c948bde730605ed1bd2af24c2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1260,14 +1260,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(
@@ -1990,12 +1982,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()) {
mstensho (USE GERRIT) 2016/10/24 08:39:35 Yeah, we used to check for this before your change
+ offsetFromTopOfPage =
+ pageLogicalHeightForOffset(rowObject.logicalTop()) -
+ pageRemainingLogicalHeightForOffset(rowObject.logicalTop(),
mstensho (USE GERRIT) 2016/10/24 08:39:35 It's not allowed to call pageRemainingLogicalHeigh
+ AssociateWithLatterPage);
+ rowIsAtTopOfColumn = !offsetFromTopOfPage ||
+ offsetFromTopOfPage <= table()->vBorderSpacing();
+ }
+
if (!rowIsAtTopOfColumn)
return;
}
@@ -2015,6 +2013,9 @@ void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject,
}
// If we have a header group we will paint it at the top of each page,
// move the rows down to accomodate it.
+ if (rowIsAtTopOfColumn && offsetFromTopOfPage)
+ paginationStrut -= offsetFromTopOfPage.toInt();
+
mstensho (USE GERRIT) 2016/10/24 08:39:35 Better delete this blank line, so that it's a bit
paginationStrut += state.heightOffsetForTableHeaders().toInt();
rowObject.setPaginationStrut(LayoutUnit(paginationStrut));

Powered by Google App Engine
This is Rietveld 408576698