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

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, 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 408bd532c4fb75cb1234730a04e3049e5787535e..c8534125f5df107ac270755c59be4ad24643998c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -647,10 +647,33 @@ 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();
+ state.SetHeightOffsetForTableFooters(offset_for_table_footers);
mstensho (USE GERRIT) 2017/06/16 08:43:06 What if we delay setting this until right before l
rhogan 2017/06/20 18:46:05 Yup, reorganized this.
+ SetRowOffsetFromRepeatingFooter(offset_for_table_footers);
+ }
+ }
+
// Lay out table header group.
if (LayoutTableSection* section = Header()) {
+ // Reset the offset temporarily so that we can ignore it when paginating
+ // the content of the footer itself.
+ LayoutUnit offset_for_table_footers = state.HeightOffsetForTableFooters();
+ state.SetHeightOffsetForTableFooters(LayoutUnit());
LayoutSection(*section, layouter, section_logical_left,
table_height_changing);
+ state.SetHeightOffsetForTableFooters(offset_for_table_footers);
if (state.IsPaginated() && IsPageLogicalHeightKnown()) {
// If the repeating header group allows at least one row of content,
// then store the offset for other sections to offset their rows
@@ -687,10 +710,19 @@ void LayoutTable::UpdateLayout() {
// Lay out table footer.
if (LayoutTableSection* section = Footer()) {
+ // Reset the offset temporarily so that we can ignore it when paginating
+ // the content of the footer itself.
+ LayoutUnit offset_for_table_footers = state.HeightOffsetForTableFooters();
+ state.SetHeightOffsetForTableFooters(LayoutUnit());
mstensho (USE GERRIT) 2017/06/16 08:43:06 No need to temporarily reset this, if you just mov
rhogan 2017/06/20 18:46:05 ditto.
LayoutSection(*section, layouter, section_logical_left,
table_height_changing);
+ state.SetHeightOffsetForTableFooters(offset_for_table_footers);
}
+ // We no longer need to account for repeating table headers.
+ state.SetHeightOffsetForTableHeaders(LayoutUnit());
mstensho (USE GERRIT) 2017/06/16 08:43:06 I don't think I understand why we need to reset th
rhogan 2017/06/20 18:46:05 We don't want layout of the footer sections or cap
+ state.SetHeightOffsetForTableFooters(LayoutUnit());
+
SetLogicalHeight(table_box_logical_top + border_and_padding_before);
LayoutUnit computed_logical_height = LogicalHeightFromStyle();

Powered by Google App Engine
This is Rietveld 408576698