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

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

Issue 2199553002: Don't repeat header groups when one row of content doesn't fit on the first page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug 621258 Created 4 years, 5 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 bc191a456f0e265f548eac32a1ec6dfb4bf06c48..33371708002255966bb7a4fd0f32d62689690267 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1001,6 +1001,10 @@ void LayoutTableSection::layoutRows()
if (isPaginated) {
paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r]));
if (paginationStrutOnRow) {
+ // 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 == 0 && table()->sectionAbove(this) == table()->header())
+ state.setHeightOffsetForTableHeaders(state.heightOffsetForTableHeaders() - table()->header()->logicalHeight());
// If we have a header group we will paint it at the top of each page, move the rows
// down to accomodate it.
paginationStrutOnRow += state.heightOffsetForTableHeaders().toInt();
@@ -1721,6 +1725,16 @@ bool LayoutTableSection::hasRepeatingHeaderGroup() const
LayoutUnit pageHeight = table()->pageLogicalHeightForOffset(LayoutUnit());
if (!pageHeight)
return false;
+
+ if (logicalHeight() > pageHeight)
+ return false;
+
+ // If the first row of the section after the header group doesn't fit on the page, then
+ // don't repeat the header on each page. See https://drafts.csswg.org/css-tables-3/#repeated-headers
+ LayoutTableSection* sectionBelow = table()->sectionBelow(this);
+ if (sectionBelow && sectionBelow->paginationStrutForRow(sectionBelow->firstRow(), sectionBelow->logicalTop()))
+ return false;
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698