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

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

Issue 2433473002: Move table row pagination strut insertion to the first layout pass. (Closed)
Patch Set: Rebaseline semi-manually thank you very much. 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 9fcc1b0039efda61d48d05c709e421f2fe0a52a0..5d3edd3625fba4fb60f42dfdb100eb2fa9f3efe7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -621,8 +621,29 @@ void LayoutTable::layout() {
}
// Lay out table header group.
- if (LayoutTableSection* section = header())
+ if (LayoutTableSection* section = header()) {
layoutSection(*section, layouter, sectionLogicalLeft);
+ if (state.isPaginated()) {
+ // If the repeating header group allows at least one row of content,
+ // then store the offset for other sections to offset their rows
+ // against.
+ LayoutUnit sectionLogicalHeight = section->logicalHeight();
+ if (sectionLogicalHeight <
+ section->pageLogicalHeightForOffset(section->logicalTop()) &&
+ section->getPaginationBreakability() != AllowAnyBreaks) {
+ LayoutUnit offsetForTableHeaders =
+ state.heightOffsetForTableHeaders();
+ // Don't include any strut in the header group - we only want the
+ // height from its content.
+ offsetForTableHeaders += sectionLogicalHeight;
+ if (LayoutTableRow* row = section->firstRow())
+ offsetForTableHeaders -= row->paginationStrut();
+ section->setOffsetForRepeatingHeader(
+ state.heightOffsetForTableHeaders());
+ state.setHeightOffsetForTableHeaders(offsetForTableHeaders);
+ }
+ }
+ }
// Lay out table body groups, and column groups.
for (LayoutObject* child = firstChild(); child;
@@ -658,7 +679,6 @@ void LayoutTable::layout() {
floorToInt(computedLogicalHeight - totalSectionLogicalHeight));
}
- bool isPaginated = view()->layoutState()->isPaginated();
LayoutUnit logicalOffset =
topSection ? topSection->logicalTop() : LayoutUnit();
for (LayoutTableSection* section = topSection; section;
@@ -666,21 +686,6 @@ void LayoutTable::layout() {
section->setLogicalTop(logicalOffset);
section->layoutRows();
logicalOffset += section->logicalHeight();
- // If the section is a repeating header group that allows at least one row
- // of content then store the offset for other sections to offset their
- // rows against.
- if (isPaginated && m_head && m_head == section &&
- section->logicalHeight() <
- section->pageLogicalHeightForOffset(logicalOffset) &&
- section->getPaginationBreakability() != LayoutBox::AllowAnyBreaks) {
- LayoutUnit offsetForTableHeaders = state.heightOffsetForTableHeaders();
- // Don't include any strut in the header group - we only want the height
- // from its content.
- offsetForTableHeaders += section->logicalHeight();
- if (LayoutTableRow* row = section->firstRow())
- offsetForTableHeaders -= row->paginationStrut();
- state.setHeightOffsetForTableHeaders(offsetForTableHeaders);
- }
}
if (!topSection && computedLogicalHeight > totalSectionLogicalHeight &&

Powered by Google App Engine
This is Rietveld 408576698