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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.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/LayoutTableSection.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index e0d07324e6677ea00502bf1a0fdd5314fc50b32a..cfe34b7f0f245b3e8df97749d28fbaaded318628 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -95,7 +95,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
}
@@ -1216,7 +1217,11 @@ 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;
@@ -1226,6 +1231,11 @@ int LayoutTableSection::PaginationStrutForRow(LayoutTableRow* row,
if (row_logical_height > page_logical_height)
return 0;
+ if (make_room_for_repeating_footer) {
+ row_logical_height +=
+ View()->GetLayoutState()->HeightOffsetForTableFooters();
+ }
+
LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
logical_offset, LayoutBlock::kAssociateWithLatterPage);
if (remaining_logical_height >= row_logical_height)
@@ -1912,15 +1922,15 @@ 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 {
+ DCHECK(Table()->Header() == this || Table()->Footer() == this);
if (GetPaginationBreakability() == kAllowAnyBreaks)
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;
@@ -1937,23 +1947,39 @@ bool LayoutTableSection::HeaderGroupShouldRepeat() const {
return true;
}
+bool LayoutTableSection::HeaderGroupShouldRepeat() const {
mstensho (USE GERRIT) 2017/07/17 10:38:08 Maybe these could/should be inline? It's a one-lin
rhogan 2017/07/24 18:56:07 Done.
+ 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
+ // 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);
}
return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal(
ancestor, transform_state, flags);

Powered by Google App Engine
This is Rietveld 408576698