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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
10 * 10 *
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 needs_section_recalc_(false), 62 needs_section_recalc_(false),
63 column_logical_width_changed_(false), 63 column_logical_width_changed_(false),
64 column_layout_objects_valid_(false), 64 column_layout_objects_valid_(false),
65 no_cell_colspan_at_least_(0), 65 no_cell_colspan_at_least_(0),
66 h_spacing_(0), 66 h_spacing_(0),
67 v_spacing_(0), 67 v_spacing_(0),
68 border_start_(0), 68 border_start_(0),
69 border_end_(0) { 69 border_end_(0) {
70 DCHECK(!ChildrenInline()); 70 DCHECK(!ChildrenInline());
71 effective_column_positions_.Fill(0, 1); 71 effective_column_positions_.Fill(0, 1);
72 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
72 } 73 }
73 74
74 LayoutTable::~LayoutTable() {} 75 LayoutTable::~LayoutTable() {}
75 76
76 void LayoutTable::StyleDidChange(StyleDifference diff, 77 void LayoutTable::StyleDidChange(StyleDifference diff,
77 const ComputedStyle* old_style) { 78 const ComputedStyle* old_style) {
78 LayoutBlock::StyleDidChange(diff, old_style); 79 LayoutBlock::StyleDidChange(diff, old_style);
79 80
80 bool old_fixed_table_layout = 81 bool old_fixed_table_layout =
81 old_style ? old_style->IsFixedTableLayout() : false; 82 old_style ? old_style->IsFixedTableLayout() : false;
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 647 }
647 LayoutUnit current_available_logical_height = 648 LayoutUnit current_available_logical_height =
648 AvailableLogicalHeight(kIncludeMarginBorderPadding); 649 AvailableLogicalHeight(kIncludeMarginBorderPadding);
649 TableHeightChangingValue table_height_changing = 650 TableHeightChangingValue table_height_changing =
650 old_available_logical_height_ && old_available_logical_height_ != 651 old_available_logical_height_ && old_available_logical_height_ !=
651 current_available_logical_height 652 current_available_logical_height
652 ? kTableHeightChanging 653 ? kTableHeightChanging
653 : kTableHeightNotChanging; 654 : kTableHeightNotChanging;
654 old_available_logical_height_ = current_available_logical_height; 655 old_available_logical_height_ = current_available_logical_height;
655 656
657 // Lay out table footer to get its raw height. This will help us decide
658 // 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
659 if (LayoutTableSection* section = Footer()) {
660 if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
661 section->LayoutIfNeeded();
662 int section_logical_height = section->CalcRowLogicalHeight();
663 section->SetLogicalHeight(LayoutUnit(section_logical_height));
664 }
665 }
666
656 // Lay out table header group. 667 // Lay out table header group.
657 if (LayoutTableSection* section = Header()) { 668 if (LayoutTableSection* section = Header()) {
658 LayoutSection(*section, layouter, section_logical_left, 669 LayoutSection(*section, layouter, section_logical_left,
659 table_height_changing); 670 table_height_changing);
660 if (state.IsPaginated()) { 671 if (state.IsPaginated()) {
661 // If the repeating header group allows at least one row of content, 672 // If the repeating header group allows at least one row of content,
662 // then store the offset for other sections to offset their rows 673 // then store the offset for other sections to offset their rows
663 // against. 674 // against.
664 LayoutUnit section_logical_height = section->LogicalHeight(); 675 if (section->IsRepeatingHeaderGroup()) {
665 if (section_logical_height <
666 section->PageLogicalHeightForOffset(section->LogicalTop()) &&
667 section->GetPaginationBreakability() != kAllowAnyBreaks) {
668 // Don't include any strut in the header group - we only want the 676 // Don't include any strut in the header group - we only want the
669 // height from its content. 677 // height from its content.
670 LayoutUnit offset_for_table_headers = section_logical_height; 678 LayoutUnit offset_for_table_headers = section->LogicalHeight();
671 if (LayoutTableRow* row = section->FirstRow()) 679 if (LayoutTableRow* row = section->FirstRow())
672 offset_for_table_headers -= row->PaginationStrut(); 680 offset_for_table_headers -= row->PaginationStrut();
673 SetRowOffsetFromRepeatingHeader(offset_for_table_headers); 681 SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
674 } 682 }
675 } 683 }
676 } 684 }
677 685
678 // Lay out table body groups, and column groups. 686 // Lay out table body groups, and column groups.
679 for (LayoutObject* child = FirstChild(); child; 687 for (LayoutObject* child = FirstChild(); child;
680 child = child->NextSibling()) { 688 child = child->NextSibling()) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 for (LayoutTableSection* section = TopSection(); section; 870 for (LayoutTableSection* section = TopSection(); section;
863 section = SectionBelow(section)) 871 section = SectionBelow(section))
864 AddOverflowFromChild(*section); 872 AddOverflowFromChild(*section);
865 } 873 }
866 874
867 void LayoutTable::PaintObject(const PaintInfo& paint_info, 875 void LayoutTable::PaintObject(const PaintInfo& paint_info,
868 const LayoutPoint& paint_offset) const { 876 const LayoutPoint& paint_offset) const {
869 TablePainter(*this).PaintObject(paint_info, paint_offset); 877 TablePainter(*this).PaintObject(paint_info, paint_offset);
870 } 878 }
871 879
872 void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const { 880 void LayoutTable::SubtractCaptionRect(LayoutRect& rect, bool after_only) const {
873 for (unsigned i = 0; i < captions_.size(); i++) { 881 for (unsigned i = 0; i < captions_.size(); i++) {
874 LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() + 882 LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() +
875 captions_[i]->MarginBefore() + 883 captions_[i]->MarginBefore() +
876 captions_[i]->MarginAfter(); 884 captions_[i]->MarginAfter();
877 bool caption_is_before = 885 bool caption_is_before =
878 (captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^ 886 (captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^
879 Style()->IsFlippedBlocksWritingMode(); 887 Style()->IsFlippedBlocksWritingMode();
888 if (caption_is_before && after_only)
889 continue;
880 if (Style()->IsHorizontalWritingMode()) { 890 if (Style()->IsHorizontalWritingMode()) {
881 rect.SetHeight(rect.Height() - caption_logical_height); 891 rect.SetHeight(rect.Height() - caption_logical_height);
882 if (caption_is_before) 892 if (caption_is_before)
883 rect.Move(LayoutUnit(), caption_logical_height); 893 rect.Move(LayoutUnit(), caption_logical_height);
884 } else { 894 } else {
885 rect.SetWidth(rect.Width() - caption_logical_height); 895 rect.SetWidth(rect.Width() - caption_logical_height);
886 if (caption_is_before) 896 if (caption_is_before)
887 rect.Move(caption_logical_height, LayoutUnit()); 897 rect.Move(caption_logical_height, LayoutUnit());
888 } 898 }
889 } 899 }
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 } 1770 }
1761 1771
1762 LayoutUnit LayoutTable::PaddingRight() const { 1772 LayoutUnit LayoutTable::PaddingRight() const {
1763 if (ShouldCollapseBorders()) 1773 if (ShouldCollapseBorders())
1764 return LayoutUnit(); 1774 return LayoutUnit();
1765 1775
1766 return LayoutBlock::PaddingRight(); 1776 return LayoutBlock::PaddingRight();
1767 } 1777 }
1768 1778
1769 } // namespace blink 1779 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698