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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTable.cpp

Issue 2584143003: Repeat footers in paginated context (Closed)
Patch Set: bug 656232 Created 3 years, 7 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index e7dfbd5d600d8bd73e9b0dd773b26d280807bc38..c4f6b7c238e4db8f107a59ada1b4bee073d169c6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -69,6 +69,7 @@ LayoutTable::LayoutTable(Element* element)
border_end_(0) {
DCHECK(!ChildrenInline());
effective_column_positions_.Fill(0, 1);
+ position_of_repeating_footer_group_on_page_.Fill(LayoutUnit(), 1);
mstensho (USE GERRIT) 2017/05/08 13:55:59 Seems unnecessary if we're not paginating.
rhogan 2017/05/09 19:57:15 I'm not sure I can zap this and rebuild it each ti
mstensho (USE GERRIT) 2017/05/10 10:59:03 How about moving initialization to LayoutTableSect
}
LayoutTable::~LayoutTable() {}
@@ -653,6 +654,16 @@ void LayoutTable::UpdateLayout() {
: kTableHeightNotChanging;
old_available_logical_height_ = current_available_logical_height;
+ // Lay out table footer to get its raw height. This will help us decide
+ // if we can repeat it in each page/column.
mstensho (USE GERRIT) 2017/05/08 13:55:58 I must say that I'm still a bit concerned about th
rhogan 2017/05/09 19:57:15 Great. :)
mstensho (USE GERRIT) 2017/05/10 10:59:03 But, while I think it's safe, could you please rem
+ if (LayoutTableSection* section = Footer()) {
+ if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
+ section->LayoutIfNeeded();
+ int section_logical_height = section->CalcRowLogicalHeight();
+ section->SetLogicalHeight(LayoutUnit(section_logical_height));
+ }
+ }
+
// Lay out table header group.
if (LayoutTableSection* section = Header()) {
LayoutSection(*section, layouter, section_logical_left,
@@ -661,13 +672,10 @@ void LayoutTable::UpdateLayout() {
// If the repeating header group allows at least one row of content,
// then store the offset for other sections to offset their rows
// against.
- LayoutUnit section_logical_height = section->LogicalHeight();
- if (section_logical_height <
- section->PageLogicalHeightForOffset(section->LogicalTop()) &&
- section->GetPaginationBreakability() != kAllowAnyBreaks) {
+ if (section->IsRepeatingHeaderGroup()) {
// Don't include any strut in the header group - we only want the
// height from its content.
- LayoutUnit offset_for_table_headers = section_logical_height;
+ LayoutUnit offset_for_table_headers = section->LogicalHeight();
if (LayoutTableRow* row = section->FirstRow())
offset_for_table_headers -= row->PaginationStrut();
SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
@@ -869,7 +877,7 @@ void LayoutTable::PaintObject(const PaintInfo& paint_info,
TablePainter(*this).PaintObject(paint_info, paint_offset);
}
-void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const {
+void LayoutTable::SubtractCaptionRect(LayoutRect& rect, bool after_only) const {
for (unsigned i = 0; i < captions_.size(); i++) {
LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() +
captions_[i]->MarginBefore() +
@@ -877,6 +885,8 @@ void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const {
bool caption_is_before =
(captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^
Style()->IsFlippedBlocksWritingMode();
+ if (caption_is_before && after_only)
+ continue;
if (Style()->IsHorizontalWritingMode()) {
rect.SetHeight(rect.Height() - caption_logical_height);
if (caption_is_before)

Powered by Google App Engine
This is Rietveld 408576698