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

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

Issue 2584143003: Repeat footers in paginated context (Closed)
Patch Set: bug 656232 Created 3 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 1c4df9ff6e494915772fd95bd7f9162dbe1d9958..afbd6a64d0a985f9f016e50c1011423971ee799c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -650,6 +650,23 @@ void LayoutTable::UpdateLayout() {
: kTableHeightNotChanging;
old_available_logical_height_ = current_available_logical_height;
+ // Lay out table footer to get its raw height. This will help us decide
+ // if we can repeat it in each page/column.
+ if (LayoutTableSection* section = Footer()) {
+ if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
+ section->LayoutIfNeeded();
+ int section_logical_height = section->CalcRowLogicalHeight();
+ section->SetLogicalHeight(LayoutUnit(section_logical_height));
+ }
+ section->DetermineIfFooterGroupShouldRepeat();
+ if (section->IsRepeatingFooterGroup()) {
+ LayoutUnit offset_for_table_footers =
+ state.HeightOffsetForTableFooters();
+ offset_for_table_footers += section->LogicalHeight();
+ SetRowOffsetFromRepeatingFooter(offset_for_table_footers);
+ }
+ }
+
// Lay out table header group.
if (LayoutTableSection* section = Header()) {
LayoutSection(*section, layouter, section_logical_left,
@@ -666,12 +683,13 @@ void LayoutTable::UpdateLayout() {
// height from its content.
if (LayoutTableRow* row = section->FirstRow())
offset_for_table_headers -= row->PaginationStrut();
- state.SetHeightOffsetForTableHeaders(offset_for_table_headers);
SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
}
}
}
+ state.SetHeightOffsetForTableHeaders(RowOffsetFromRepeatingHeader());
+ state.SetHeightOffsetForTableFooters(RowOffsetFromRepeatingFooter());
// Lay out table body groups, and column groups.
for (LayoutObject* child = FirstChild(); child;
child = child->NextSibling()) {
@@ -687,6 +705,9 @@ void LayoutTable::UpdateLayout() {
DCHECK(child->IsTableCaption());
}
}
+ // Reset these so they don't affect the layout of footers or captions.
+ state.SetHeightOffsetForTableHeaders(LayoutUnit());
+ state.SetHeightOffsetForTableFooters(LayoutUnit());
// Lay out table footer.
if (LayoutTableSection* section = Footer()) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableSection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698