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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2584143003: Repeat footers in paginated context (Closed)
Patch Set: bug 656232 Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 line_box.SetIsFirstAfterPageBreak(false); 1142 line_box.SetIsFirstAfterPageBreak(false);
1143 LayoutState* layout_state = View()->GetLayoutState(); 1143 LayoutState* layout_state = View()->GetLayoutState();
1144 if (!layout_state->IsPaginated()) 1144 if (!layout_state->IsPaginated())
1145 return; 1145 return;
1146 if (!IsPageLogicalHeightKnown()) 1146 if (!IsPageLogicalHeightKnown())
1147 return; 1147 return;
1148 LayoutUnit page_logical_height = PageLogicalHeightForOffset(logical_offset); 1148 LayoutUnit page_logical_height = PageLogicalHeightForOffset(logical_offset);
1149 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset( 1149 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
1150 logical_offset, kAssociateWithLatterPage); 1150 logical_offset, kAssociateWithLatterPage);
1151 int line_index = LineCount(&line_box); 1151 int line_index = LineCount(&line_box);
1152 if (remaining_logical_height < line_height || 1152 // We need to detect if we overlap a repeating footer and if so take the
1153 // full remaining logical height as our strut to the next page.
1154 LayoutUnit remaining_logical_height_including_footer =
1155 remaining_logical_height - layout_state->HeightOffsetForTableFooters();
1156 if (remaining_logical_height_including_footer < line_height ||
1153 (ShouldBreakAtLineToAvoidWidow() && 1157 (ShouldBreakAtLineToAvoidWidow() &&
1154 LineBreakToAvoidWidow() == line_index)) { 1158 LineBreakToAvoidWidow() == line_index)) {
1155 LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent( 1159 LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent(
1156 logical_offset, remaining_logical_height, line_height); 1160 logical_offset, remaining_logical_height, line_height);
1157 LayoutUnit new_logical_offset = logical_offset + pagination_strut; 1161 LayoutUnit new_logical_offset = logical_offset + pagination_strut;
1158 // Moving to a different page or column may mean that its height is 1162 // Moving to a different page or column may mean that its height is
1159 // different. 1163 // different.
1160 page_logical_height = PageLogicalHeightForOffset(new_logical_offset); 1164 page_logical_height = PageLogicalHeightForOffset(new_logical_offset);
1161 if (line_height > page_logical_height) { 1165 if (line_height > page_logical_height) {
1162 // Too tall to fit in one page / column. Give up. Don't push to the next 1166 // Too tall to fit in one page / column. Give up. Don't push to the next
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 return logical_offset; 1253 return logical_offset;
1250 LayoutUnit child_logical_height = LogicalHeightForChild(child); 1254 LayoutUnit child_logical_height = LogicalHeightForChild(child);
1251 // Floats' margins do not collapse with page or column boundaries. 1255 // Floats' margins do not collapse with page or column boundaries.
1252 if (child.IsFloating()) 1256 if (child.IsFloating())
1253 child_logical_height += 1257 child_logical_height +=
1254 MarginBeforeForChild(child) + MarginAfterForChild(child); 1258 MarginBeforeForChild(child) + MarginAfterForChild(child);
1255 if (!IsPageLogicalHeightKnown()) 1259 if (!IsPageLogicalHeightKnown())
1256 return logical_offset; 1260 return logical_offset;
1257 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset( 1261 LayoutUnit remaining_logical_height = PageRemainingLogicalHeightForOffset(
1258 logical_offset, kAssociateWithLatterPage); 1262 logical_offset, kAssociateWithLatterPage);
1259 if (remaining_logical_height >= child_logical_height) 1263 LayoutUnit remaining_logical_height_including_footer =
1264 remaining_logical_height -
1265 View()->GetLayoutState()->HeightOffsetForTableFooters();
1266 if (remaining_logical_height_including_footer >= child_logical_height)
1260 return logical_offset; // It fits fine where it is. No need to break. 1267 return logical_offset; // It fits fine where it is. No need to break.
1261 LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent( 1268 LayoutUnit pagination_strut = CalculatePaginationStrutToFitContent(
1262 logical_offset, remaining_logical_height, child_logical_height); 1269 logical_offset, remaining_logical_height, child_logical_height);
1263 if (pagination_strut == remaining_logical_height && 1270 if (pagination_strut == remaining_logical_height &&
1264 remaining_logical_height == PageLogicalHeightForOffset(logical_offset)) { 1271 remaining_logical_height == PageLogicalHeightForOffset(logical_offset)) {
1265 // Don't break if we were at the top of a page, and we failed to fit the 1272 // Don't break if we were at the top of a page, and we failed to fit the
1266 // content completely. No point in leaving a page completely blank. 1273 // content completely. No point in leaving a page completely blank.
1267 return logical_offset; 1274 return logical_offset;
1268 } 1275 }
1269 1276
(...skipping 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 include_block_overflows); 4749 include_block_overflows);
4743 } 4750 }
4744 4751
4745 void LayoutBlockFlow::InvalidateDisplayItemClients( 4752 void LayoutBlockFlow::InvalidateDisplayItemClients(
4746 PaintInvalidationReason invalidation_reason) const { 4753 PaintInvalidationReason invalidation_reason) const {
4747 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( 4754 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients(
4748 invalidation_reason); 4755 invalidation_reason);
4749 } 4756 }
4750 4757
4751 } // namespace blink 4758 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/html.css ('k') | third_party/WebKit/Source/core/layout/LayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698