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

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

Issue 2079603002: Handle nested theads correctly when paginated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug 620456 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 ac94a91fe5b355a0d83c318bf2a99b9a798e08c7..407c56fca2ded2dd62a4a5a4a208d9a46a630fea 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -107,6 +107,7 @@ LayoutTableSection::LayoutTableSection(Element* element)
, m_needsCellRecalc(false)
, m_forceSlowPaintPathWithOverflowingCell(false)
, m_hasMultipleCellLevels(false)
+ , m_offsetForRepeatingHeader(LayoutUnit())
{
// init LayoutObject attributes
setInline(false); // our object is not Inline
@@ -967,6 +968,15 @@ void LayoutTableSection::layoutRows()
unsigned nEffCols = table()->numEffectiveColumns();
bool isPaginated = view()->layoutState()->isPaginated();
+ if (isPaginated) {
+ LayoutTableSection* header = table()->header();
+ // If we're a table header nested inside a table cell then we want to repeat on each
+ // page, but below the header we're nested inside. Note we don't try to match the padding
+ // on the cell on each repeated header.
+ if (header && header == this)
+ setOffsetForRepeatingHeader(view()->layoutState()->heightOffsetForTableHeaders());
+ }
+
LayoutState state(*this, locationOffset());
for (unsigned r = 0; r < totalRows; r++) {
@@ -981,11 +991,9 @@ 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();
+ paginationStrutOnRow += state.heightOffsetForTableHeaders().toInt();
for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex++)
m_rowPos[rowIndex] += paginationStrutOnRow;
}

Powered by Google App Engine
This is Rietveld 408576698