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

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, 8 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);
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 639 }
639 LayoutUnit current_available_logical_height = 640 LayoutUnit current_available_logical_height =
640 AvailableLogicalHeight(kIncludeMarginBorderPadding); 641 AvailableLogicalHeight(kIncludeMarginBorderPadding);
641 TableHeightChangingValue table_height_changing = 642 TableHeightChangingValue table_height_changing =
642 old_available_logical_height_ && old_available_logical_height_ != 643 old_available_logical_height_ && old_available_logical_height_ !=
643 current_available_logical_height 644 current_available_logical_height
644 ? kTableHeightChanging 645 ? kTableHeightChanging
645 : kTableHeightNotChanging; 646 : kTableHeightNotChanging;
646 old_available_logical_height_ = current_available_logical_height; 647 old_available_logical_height_ = current_available_logical_height;
647 648
649 // Lay out table footer.
mstensho (USE GERRIT) 2017/04/24 11:57:15 Is it necessary to do this out-of-order? We should
650 if (LayoutTableSection* section = Footer()) {
651 if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
652 section->LayoutIfNeeded();
653 int section_logical_height = section->CalcRowLogicalHeight();
654 section->SetLogicalHeight(LayoutUnit(section_logical_height));
655 }
656 }
657
648 // Lay out table header group. 658 // Lay out table header group.
649 if (LayoutTableSection* section = Header()) { 659 if (LayoutTableSection* section = Header()) {
650 LayoutSection(*section, layouter, section_logical_left, 660 LayoutSection(*section, layouter, section_logical_left,
651 table_height_changing); 661 table_height_changing);
652 if (state.IsPaginated()) { 662 if (state.IsPaginated()) {
653 // If the repeating header group allows at least one row of content, 663 // If the repeating header group allows at least one row of content,
654 // then store the offset for other sections to offset their rows 664 // then store the offset for other sections to offset their rows
655 // against. 665 // against.
656 LayoutUnit section_logical_height = section->LogicalHeight(); 666 LayoutUnit section_logical_height = section->LogicalHeight();
657 if (section_logical_height < 667 if (section_logical_height <
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 for (LayoutTableSection* section = TopSection(); section; 849 for (LayoutTableSection* section = TopSection(); section;
840 section = SectionBelow(section)) 850 section = SectionBelow(section))
841 AddOverflowFromChild(*section); 851 AddOverflowFromChild(*section);
842 } 852 }
843 853
844 void LayoutTable::PaintObject(const PaintInfo& paint_info, 854 void LayoutTable::PaintObject(const PaintInfo& paint_info,
845 const LayoutPoint& paint_offset) const { 855 const LayoutPoint& paint_offset) const {
846 TablePainter(*this).PaintObject(paint_info, paint_offset); 856 TablePainter(*this).PaintObject(paint_info, paint_offset);
847 } 857 }
848 858
849 void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const { 859 void LayoutTable::SubtractCaptionRect(LayoutRect& rect, bool after_only) const {
850 for (unsigned i = 0; i < captions_.size(); i++) { 860 for (unsigned i = 0; i < captions_.size(); i++) {
851 LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() + 861 LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() +
852 captions_[i]->MarginBefore() + 862 captions_[i]->MarginBefore() +
853 captions_[i]->MarginAfter(); 863 captions_[i]->MarginAfter();
854 bool caption_is_before = 864 bool caption_is_before =
855 (captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^ 865 (captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^
856 Style()->IsFlippedBlocksWritingMode(); 866 Style()->IsFlippedBlocksWritingMode();
867 if (caption_is_before && after_only)
868 continue;
857 if (Style()->IsHorizontalWritingMode()) { 869 if (Style()->IsHorizontalWritingMode()) {
858 rect.SetHeight(rect.Height() - caption_logical_height); 870 rect.SetHeight(rect.Height() - caption_logical_height);
859 if (caption_is_before) 871 if (caption_is_before)
860 rect.Move(LayoutUnit(), caption_logical_height); 872 rect.Move(LayoutUnit(), caption_logical_height);
861 } else { 873 } else {
862 rect.SetWidth(rect.Width() - caption_logical_height); 874 rect.SetWidth(rect.Width() - caption_logical_height);
863 if (caption_is_before) 875 if (caption_is_before)
864 rect.Move(caption_logical_height, LayoutUnit()); 876 rect.Move(caption_logical_height, LayoutUnit());
865 } 877 }
866 } 878 }
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 } 1749 }
1738 1750
1739 LayoutUnit LayoutTable::PaddingRight() const { 1751 LayoutUnit LayoutTable::PaddingRight() const {
1740 if (CollapseBorders()) 1752 if (CollapseBorders())
1741 return LayoutUnit(); 1753 return LayoutUnit();
1742 1754
1743 return LayoutBlock::PaddingRight(); 1755 return LayoutBlock::PaddingRight();
1744 } 1756 }
1745 1757
1746 } // namespace blink 1758 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698