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

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, 5 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 LayoutUnit current_available_logical_height = 644 LayoutUnit current_available_logical_height =
645 AvailableLogicalHeight(kIncludeMarginBorderPadding); 645 AvailableLogicalHeight(kIncludeMarginBorderPadding);
646 TableHeightChangingValue table_height_changing = 646 TableHeightChangingValue table_height_changing =
647 old_available_logical_height_ && old_available_logical_height_ != 647 old_available_logical_height_ && old_available_logical_height_ !=
648 current_available_logical_height 648 current_available_logical_height
649 ? kTableHeightChanging 649 ? kTableHeightChanging
650 : kTableHeightNotChanging; 650 : kTableHeightNotChanging;
651 old_available_logical_height_ = current_available_logical_height; 651 old_available_logical_height_ = current_available_logical_height;
652 652
653 // Lay out table footer to get its raw height. This will help us decide
654 // if we can repeat it in each page/column.
655 if (LayoutTableSection* section = Footer()) {
656 if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
657 section->LayoutIfNeeded();
658 int section_logical_height = section->CalcRowLogicalHeight();
659 section->SetLogicalHeight(LayoutUnit(section_logical_height));
660 }
661 section->DetermineIfFooterGroupShouldRepeat();
662 if (section->IsRepeatingFooterGroup()) {
663 LayoutUnit offset_for_table_footers =
664 state.HeightOffsetForTableFooters();
665 offset_for_table_footers += section->LogicalHeight();
666 SetRowOffsetFromRepeatingFooter(offset_for_table_footers);
667 }
668 }
669
653 // Lay out table header group. 670 // Lay out table header group.
654 if (LayoutTableSection* section = Header()) { 671 if (LayoutTableSection* section = Header()) {
655 LayoutSection(*section, layouter, section_logical_left, 672 LayoutSection(*section, layouter, section_logical_left,
656 table_height_changing); 673 table_height_changing);
657 if (state.IsPaginated() && IsPageLogicalHeightKnown()) { 674 if (state.IsPaginated() && IsPageLogicalHeightKnown()) {
658 // If the repeating header group allows at least one row of content, 675 // If the repeating header group allows at least one row of content,
659 // then store the offset for other sections to offset their rows 676 // then store the offset for other sections to offset their rows
660 // against. 677 // against.
661 if (section->IsRepeatingHeaderGroup()) { 678 if (section->IsRepeatingHeaderGroup()) {
662 LayoutUnit offset_for_table_headers = 679 LayoutUnit offset_for_table_headers =
663 state.HeightOffsetForTableHeaders(); 680 state.HeightOffsetForTableHeaders();
664 offset_for_table_headers += section->LogicalHeight(); 681 offset_for_table_headers += section->LogicalHeight();
665 // Don't include any strut in the header group - we only want the 682 // Don't include any strut in the header group - we only want the
666 // height from its content. 683 // height from its content.
667 if (LayoutTableRow* row = section->FirstRow()) 684 if (LayoutTableRow* row = section->FirstRow())
668 offset_for_table_headers -= row->PaginationStrut(); 685 offset_for_table_headers -= row->PaginationStrut();
669 state.SetHeightOffsetForTableHeaders(offset_for_table_headers);
670 SetRowOffsetFromRepeatingHeader(offset_for_table_headers); 686 SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
671 } 687 }
672 } 688 }
673 } 689 }
674 690
691 state.SetHeightOffsetForTableHeaders(RowOffsetFromRepeatingHeader());
692 state.SetHeightOffsetForTableFooters(RowOffsetFromRepeatingFooter());
675 // Lay out table body groups, and column groups. 693 // Lay out table body groups, and column groups.
676 for (LayoutObject* child = FirstChild(); child; 694 for (LayoutObject* child = FirstChild(); child;
677 child = child->NextSibling()) { 695 child = child->NextSibling()) {
678 if (child->IsTableSection()) { 696 if (child->IsTableSection()) {
679 if (child != Header() && child != Footer()) { 697 if (child != Header() && child != Footer()) {
680 LayoutTableSection& section = *ToLayoutTableSection(child); 698 LayoutTableSection& section = *ToLayoutTableSection(child);
681 LayoutSection(section, layouter, section_logical_left, 699 LayoutSection(section, layouter, section_logical_left,
682 table_height_changing); 700 table_height_changing);
683 } 701 }
684 } else if (child->IsLayoutTableCol()) { 702 } else if (child->IsLayoutTableCol()) {
685 child->LayoutIfNeeded(); 703 child->LayoutIfNeeded();
686 } else { 704 } else {
687 DCHECK(child->IsTableCaption()); 705 DCHECK(child->IsTableCaption());
688 } 706 }
689 } 707 }
708 // Reset these so they don't affect the layout of footers or captions.
709 state.SetHeightOffsetForTableHeaders(LayoutUnit());
710 state.SetHeightOffsetForTableFooters(LayoutUnit());
690 711
691 // Lay out table footer. 712 // Lay out table footer.
692 if (LayoutTableSection* section = Footer()) { 713 if (LayoutTableSection* section = Footer()) {
693 LayoutSection(*section, layouter, section_logical_left, 714 LayoutSection(*section, layouter, section_logical_left,
694 table_height_changing); 715 table_height_changing);
695 } 716 }
696 717
697 SetLogicalHeight(table_box_logical_top + border_and_padding_before); 718 SetLogicalHeight(table_box_logical_top + border_and_padding_before);
698 719
699 LayoutUnit computed_logical_height = LogicalHeightFromStyle(); 720 LayoutUnit computed_logical_height = LogicalHeightFromStyle();
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd(); 1644 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd();
1624 } 1645 }
1625 } 1646 }
1626 1647
1627 bool LayoutTable::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() const { 1648 bool LayoutTable::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() const {
1628 return LayoutBlock::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() && 1649 return LayoutBlock::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() &&
1629 !should_paint_all_collapsed_borders_; 1650 !should_paint_all_collapsed_borders_;
1630 } 1651 }
1631 1652
1632 } // namespace blink 1653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698