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 8a1142cdb14577b5d0c8887879d86d4df13473a1..ecf682782ea5ad236c40b2ca10c939905013a229 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
@@ -94,7 +94,8 @@ LayoutTableSection::LayoutTableSection(Element* element) |
force_full_paint_(false), |
has_multiple_cell_levels_(false), |
has_spanning_cells_(false), |
- is_repeating_header_group_(false) { |
+ is_repeating_header_group_(false), |
+ is_repeating_footer_group_(false) { |
// init LayoutObject attributes |
SetInline(false); // our object is not Inline |
} |
@@ -1215,15 +1216,24 @@ void LayoutTableSection::LayoutRows() { |
int LayoutTableSection::PaginationStrutForRow(LayoutTableRow* row, |
LayoutUnit logical_offset) const { |
DCHECK(row); |
- if (row->GetPaginationBreakability() == kAllowAnyBreaks) |
+ const LayoutTableSection* footer = Table()->Footer(); |
+ bool make_room_for_repeating_footer = |
+ footer && footer->IsRepeatingFooterGroup() && row->RowIndex(); |
+ if (!make_room_for_repeating_footer && |
+ row->GetPaginationBreakability() == kAllowAnyBreaks) |
return 0; |
if (!IsPageLogicalHeightKnown()) |
return 0; |
LayoutUnit page_logical_height = PageLogicalHeightForOffset(logical_offset); |
// If the row is too tall for the page don't insert a strut. |
LayoutUnit row_logical_height = row->LogicalHeight(); |
- if (row_logical_height > page_logical_height) |
+ if (row_logical_height > page_logical_height) { |
mstensho (USE GERRIT)
2017/06/16 08:43:06
No need for the curls.
rhogan
2017/06/20 18:46:05
OK.
|
return 0; |
+ } |
+ |
+ LayoutState* layout_state = View()->GetLayoutState(); |
mstensho (USE GERRIT)
2017/06/16 08:43:06
Please move it inside the "if (make_room_for_repea
rhogan
2017/06/20 18:46:05
Sure.
|
+ if (make_room_for_repeating_footer) |
+ row_logical_height += layout_state->HeightOffsetForTableFooters(); |
LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset( |
logical_offset, LayoutBlock::kAssociateWithLatterPage); |
@@ -1945,15 +1955,14 @@ void LayoutTableSection::AdjustRowForPagination(LayoutTableRow& row_object, |
row_object.SetLogicalHeight(LayoutUnit(LogicalHeightForRow(row_object))); |
} |
-bool LayoutTableSection::HeaderGroupShouldRepeat() const { |
- if (Table()->Header() != this) |
- return false; |
- |
+bool LayoutTableSection::GroupShouldRepeat() const { |
if (GetPaginationBreakability() == kAllowAnyBreaks) |
mstensho (USE GERRIT)
2017/06/16 08:43:06
I wonder if you should add a DCHECK at the beginni
rhogan
2017/06/20 18:46:06
Done.
|
return false; |
+ |
// TODO(rhogan): Sections can be self-painting. |
if (HasSelfPaintingLayer()) |
return false; |
+ |
// If we don't know the page height yet, just assume we fit. |
if (!IsPageLogicalHeightKnown()) |
return true; |
@@ -1970,23 +1979,39 @@ bool LayoutTableSection::HeaderGroupShouldRepeat() const { |
return true; |
} |
+bool LayoutTableSection::HeaderGroupShouldRepeat() const { |
+ if (Table()->Header() != this) |
+ return false; |
+ return GroupShouldRepeat(); |
+} |
+ |
+bool LayoutTableSection::FooterGroupShouldRepeat() const { |
+ if (Table()->Footer() != this) |
+ return false; |
+ return GroupShouldRepeat(); |
+} |
+ |
bool LayoutTableSection::MapToVisualRectInAncestorSpaceInternal( |
const LayoutBoxModelObject* ancestor, |
TransformState& transform_state, |
VisualRectFlags flags) const { |
if (ancestor == this) |
return true; |
- // Repeating table headers are painted once per fragmentation page/column. |
+ // Repeating table headers and footers are painted once per fragmentation |
mstensho (USE GERRIT)
2017/06/16 08:43:06
Instead of "fragmentation page/column", I suggest
rhogan
2017/06/20 18:46:05
Indeed.
|
+ // page/column. So we need to use the rect for the entire table because |
+ // the repeating headers/footers will appear throughout it. |
// This does not go through the regular fragmentation machinery, so we need |
// special code to expand the invalidation rect to contain all positions of |
// the header in all columns. |
// Note that this is in flow thread coordinates, not visual coordinates. The |
// enclosing LayoutFlowThread will convert to visual coordinates. |
- if (IsRepeatingHeaderGroup()) { |
+ if (IsRepeatingHeaderGroup() || IsRepeatingFooterGroup()) { |
transform_state.Flatten(); |
FloatRect rect = transform_state.LastPlanarQuad().BoundingBox(); |
rect.SetHeight(Table()->LogicalHeight()); |
transform_state.SetQuad(FloatQuad(rect)); |
+ return Table()->MapToVisualRectInAncestorSpaceInternal( |
+ ancestor, transform_state, flags); |
rhogan
2017/06/20 18:46:06
This is the place which used to trigger the DCHECK
mstensho (USE GERRIT)
2017/06/20 21:39:05
I see no DCHECK removed.
|
} |
return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal( |
ancestor, transform_state, flags); |