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

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, 6 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 640 }
641 LayoutUnit current_available_logical_height = 641 LayoutUnit current_available_logical_height =
642 AvailableLogicalHeight(kIncludeMarginBorderPadding); 642 AvailableLogicalHeight(kIncludeMarginBorderPadding);
643 TableHeightChangingValue table_height_changing = 643 TableHeightChangingValue table_height_changing =
644 old_available_logical_height_ && old_available_logical_height_ != 644 old_available_logical_height_ && old_available_logical_height_ !=
645 current_available_logical_height 645 current_available_logical_height
646 ? kTableHeightChanging 646 ? kTableHeightChanging
647 : kTableHeightNotChanging; 647 : kTableHeightNotChanging;
648 old_available_logical_height_ = current_available_logical_height; 648 old_available_logical_height_ = current_available_logical_height;
649 649
650 // Lay out table footer to get its raw height. This will help us decide
651 // if we can repeat it in each page/column.
652 if (LayoutTableSection* section = Footer()) {
653 if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
654 section->LayoutIfNeeded();
655 int section_logical_height = section->CalcRowLogicalHeight();
656 section->SetLogicalHeight(LayoutUnit(section_logical_height));
657 }
658 section->DetermineIfFooterGroupShouldRepeat();
659 if (section->IsRepeatingFooterGroup()) {
660 LayoutUnit offset_for_table_footers =
661 state.HeightOffsetForTableFooters();
662 offset_for_table_footers += section->LogicalHeight();
663 state.SetHeightOffsetForTableFooters(offset_for_table_footers);
mstensho (USE GERRIT) 2017/06/16 08:43:06 What if we delay setting this until right before l
rhogan 2017/06/20 18:46:05 Yup, reorganized this.
664 SetRowOffsetFromRepeatingFooter(offset_for_table_footers);
665 }
666 }
667
650 // Lay out table header group. 668 // Lay out table header group.
651 if (LayoutTableSection* section = Header()) { 669 if (LayoutTableSection* section = Header()) {
670 // Reset the offset temporarily so that we can ignore it when paginating
671 // the content of the footer itself.
672 LayoutUnit offset_for_table_footers = state.HeightOffsetForTableFooters();
673 state.SetHeightOffsetForTableFooters(LayoutUnit());
652 LayoutSection(*section, layouter, section_logical_left, 674 LayoutSection(*section, layouter, section_logical_left,
653 table_height_changing); 675 table_height_changing);
676 state.SetHeightOffsetForTableFooters(offset_for_table_footers);
654 if (state.IsPaginated() && IsPageLogicalHeightKnown()) { 677 if (state.IsPaginated() && IsPageLogicalHeightKnown()) {
655 // If the repeating header group allows at least one row of content, 678 // If the repeating header group allows at least one row of content,
656 // then store the offset for other sections to offset their rows 679 // then store the offset for other sections to offset their rows
657 // against. 680 // against.
658 if (section->IsRepeatingHeaderGroup()) { 681 if (section->IsRepeatingHeaderGroup()) {
659 LayoutUnit offset_for_table_headers = 682 LayoutUnit offset_for_table_headers =
660 state.HeightOffsetForTableHeaders(); 683 state.HeightOffsetForTableHeaders();
661 offset_for_table_headers += section->LogicalHeight(); 684 offset_for_table_headers += section->LogicalHeight();
662 // Don't include any strut in the header group - we only want the 685 // Don't include any strut in the header group - we only want the
663 // height from its content. 686 // height from its content.
(...skipping 16 matching lines...) Expand all
680 } 703 }
681 } else if (child->IsLayoutTableCol()) { 704 } else if (child->IsLayoutTableCol()) {
682 child->LayoutIfNeeded(); 705 child->LayoutIfNeeded();
683 } else { 706 } else {
684 DCHECK(child->IsTableCaption()); 707 DCHECK(child->IsTableCaption());
685 } 708 }
686 } 709 }
687 710
688 // Lay out table footer. 711 // Lay out table footer.
689 if (LayoutTableSection* section = Footer()) { 712 if (LayoutTableSection* section = Footer()) {
713 // Reset the offset temporarily so that we can ignore it when paginating
714 // the content of the footer itself.
715 LayoutUnit offset_for_table_footers = state.HeightOffsetForTableFooters();
716 state.SetHeightOffsetForTableFooters(LayoutUnit());
mstensho (USE GERRIT) 2017/06/16 08:43:06 No need to temporarily reset this, if you just mov
rhogan 2017/06/20 18:46:05 ditto.
690 LayoutSection(*section, layouter, section_logical_left, 717 LayoutSection(*section, layouter, section_logical_left,
691 table_height_changing); 718 table_height_changing);
719 state.SetHeightOffsetForTableFooters(offset_for_table_footers);
692 } 720 }
693 721
722 // We no longer need to account for repeating table headers.
723 state.SetHeightOffsetForTableHeaders(LayoutUnit());
mstensho (USE GERRIT) 2017/06/16 08:43:06 I don't think I understand why we need to reset th
rhogan 2017/06/20 18:46:05 We don't want layout of the footer sections or cap
724 state.SetHeightOffsetForTableFooters(LayoutUnit());
725
694 SetLogicalHeight(table_box_logical_top + border_and_padding_before); 726 SetLogicalHeight(table_box_logical_top + border_and_padding_before);
695 727
696 LayoutUnit computed_logical_height = LogicalHeightFromStyle(); 728 LayoutUnit computed_logical_height = LogicalHeightFromStyle();
697 LayoutUnit total_section_logical_height; 729 LayoutUnit total_section_logical_height;
698 if (top_section) { 730 if (top_section) {
699 total_section_logical_height = 731 total_section_logical_height =
700 bottom_section->LogicalBottom() - top_section->LogicalTop(); 732 bottom_section->LogicalBottom() - top_section->LogicalTop();
701 } 733 }
702 734
703 if (!state.IsPaginated() || 735 if (!state.IsPaginated() ||
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 collapsed_outer_borders_valid_ = true; 1644 collapsed_outer_borders_valid_ = true;
1613 if (ShouldCollapseBorders()) { 1645 if (ShouldCollapseBorders()) {
1614 collapsed_outer_border_before_ = ComputeCollapsedOuterBorderBefore(); 1646 collapsed_outer_border_before_ = ComputeCollapsedOuterBorderBefore();
1615 collapsed_outer_border_after_ = ComputeCollapsedOuterBorderAfter(); 1647 collapsed_outer_border_after_ = ComputeCollapsedOuterBorderAfter();
1616 collapsed_outer_border_start_ = ComputeCollapsedOuterBorderStart(); 1648 collapsed_outer_border_start_ = ComputeCollapsedOuterBorderStart();
1617 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd(); 1649 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd();
1618 } 1650 }
1619 } 1651 }
1620 1652
1621 } // namespace blink 1653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698