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

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

Issue 2021703002: Display table header groups at the top of each page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 6 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 e957a75496965fb1d1e15df56def9d85f6a44f29..330709877e78c9eb82ea2f75984d83f8f1108141 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -984,6 +984,11 @@ void LayoutTableSection::layoutRows()
if (isPaginated) {
paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r]));
if (paginationStrutOnRow) {
+ LayoutTableSection* header = table()->header();
+ // If we have a header group we will paint it at the top of each page, move the rows
+ // down to accomodate it.
+ if (header && header != this)
+ paginationStrutOnRow += header->logicalHeight().toInt();
for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex++)
m_rowPos[rowIndex] += paginationStrutOnRow;
}
@@ -1111,7 +1116,10 @@ void LayoutTableSection::layoutRows()
int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit logicalOffset) const
{
- if (row->getPaginationBreakability() == AllowAnyBreaks)
+ // Even if the row allows us to break-inside, we will want to put a strut on the row if we have a header
+ // group that wants to appear at the top of each page.
+ bool tableHeaderForcesStrut = table()->header() ? table()->header()->getPaginationBreakability() != AllowAnyBreaks : false;
+ if (row->getPaginationBreakability() == AllowAnyBreaks && !tableHeaderForcesStrut)
return 0;
LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
if (!pageLogicalHeight)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/paint/TableSectionPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698