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 1c653aff8018b9e432844329a840fa11fc901833..1edb17a3d5bc4c4a3abdcad3f8e69ca04f036ac7 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -1149,7 +1149,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( |
@@ -1256,7 +1260,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) |
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); |