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 4b2f79e8bd4949f6ac3a4d8a006a69478d412a16..a8957f85901520c7586d37146a9d56874a6c124c 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
@@ -647,6 +647,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, |
@@ -663,12 +680,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()) { |
@@ -684,6 +702,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()) { |