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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.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/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 494e8708ce9a3bf916d99d34d9a85062af8ee3ab..4688374ba5f7e2acb97b218fbe4f6b42fb753fdb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -1139,7 +1139,11 @@ void LayoutBlockFlow::AdjustLinePositionForPagination(RootInlineBox& line_box,
LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
logical_offset, kAssociateWithLatterPage);
int line_index = LineCount(&line_box);
- if (remaining_logical_height < line_height ||
+ // We need to detect if we overlap a repeating footer and if so take the
+ // full remaining logical height as our strut to the next page.
+ LayoutUnit remaining_logical_height_including_footer =
+ remaining_logical_height - layout_state->HeightOffsetForTableFooters();
+ if (remaining_logical_height_including_footer < line_height ||
(ShouldBreakAtLineToAvoidWidow() &&
LineBreakToAvoidWidow() == line_index)) {
LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent(
@@ -1246,7 +1250,10 @@ LayoutUnit LayoutBlockFlow::AdjustForUnsplittableChild(
return logical_offset;
LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
logical_offset, kAssociateWithLatterPage);
- if (remaining_logical_height >= child_logical_height)
+ LayoutUnit remaining_logical_height_including_footer =
+ remaining_logical_height -
+ View()->GetLayoutState()->HeightOffsetForTableFooters();
+ if (remaining_logical_height_including_footer >= child_logical_height)
mstensho (USE GERRIT) 2017/07/17 10:38:08 Why can't PageRemainingLogicalHeightForOffset() do
rhogan 2017/07/24 18:56:06 Because, as well as deciding whether the line or b
mstensho (USE GERRIT) 2017/07/25 08:59:32 Ah, true. PageRemainingLogicalHeightForOffset() s
return logical_offset; // It fits fine where it is. No need to break.
LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent(
logical_offset, remaining_logical_height, child_logical_height);

Powered by Google App Engine
This is Rietveld 408576698