OLD | NEW |
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 Loading... |
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 SetRowOffsetFromRepeatingFooter(offset_for_table_footers); |
| 664 } |
| 665 } |
| 666 |
650 // Lay out table header group. | 667 // Lay out table header group. |
651 if (LayoutTableSection* section = Header()) { | 668 if (LayoutTableSection* section = Header()) { |
652 LayoutSection(*section, layouter, section_logical_left, | 669 LayoutSection(*section, layouter, section_logical_left, |
653 table_height_changing); | 670 table_height_changing); |
654 if (state.IsPaginated() && IsPageLogicalHeightKnown()) { | 671 if (state.IsPaginated() && IsPageLogicalHeightKnown()) { |
655 // 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, |
656 // then store the offset for other sections to offset their rows | 673 // then store the offset for other sections to offset their rows |
657 // against. | 674 // against. |
658 if (section->IsRepeatingHeaderGroup()) { | 675 if (section->IsRepeatingHeaderGroup()) { |
659 LayoutUnit offset_for_table_headers = | 676 LayoutUnit offset_for_table_headers = |
660 state.HeightOffsetForTableHeaders(); | 677 state.HeightOffsetForTableHeaders(); |
661 offset_for_table_headers += section->LogicalHeight(); | 678 offset_for_table_headers += section->LogicalHeight(); |
662 // Don't include any strut in the header group - we only want the | 679 // Don't include any strut in the header group - we only want the |
663 // height from its content. | 680 // height from its content. |
664 if (LayoutTableRow* row = section->FirstRow()) | 681 if (LayoutTableRow* row = section->FirstRow()) |
665 offset_for_table_headers -= row->PaginationStrut(); | 682 offset_for_table_headers -= row->PaginationStrut(); |
666 state.SetHeightOffsetForTableHeaders(offset_for_table_headers); | |
667 SetRowOffsetFromRepeatingHeader(offset_for_table_headers); | 683 SetRowOffsetFromRepeatingHeader(offset_for_table_headers); |
668 } | 684 } |
669 } | 685 } |
670 } | 686 } |
671 | 687 |
| 688 state.SetHeightOffsetForTableHeaders(RowOffsetFromRepeatingHeader()); |
| 689 state.SetHeightOffsetForTableFooters(RowOffsetFromRepeatingFooter()); |
672 // Lay out table body groups, and column groups. | 690 // Lay out table body groups, and column groups. |
673 for (LayoutObject* child = FirstChild(); child; | 691 for (LayoutObject* child = FirstChild(); child; |
674 child = child->NextSibling()) { | 692 child = child->NextSibling()) { |
675 if (child->IsTableSection()) { | 693 if (child->IsTableSection()) { |
676 if (child != Header() && child != Footer()) { | 694 if (child != Header() && child != Footer()) { |
677 LayoutTableSection& section = *ToLayoutTableSection(child); | 695 LayoutTableSection& section = *ToLayoutTableSection(child); |
678 LayoutSection(section, layouter, section_logical_left, | 696 LayoutSection(section, layouter, section_logical_left, |
679 table_height_changing); | 697 table_height_changing); |
680 } | 698 } |
681 } else if (child->IsLayoutTableCol()) { | 699 } else if (child->IsLayoutTableCol()) { |
682 child->LayoutIfNeeded(); | 700 child->LayoutIfNeeded(); |
683 } else { | 701 } else { |
684 DCHECK(child->IsTableCaption()); | 702 DCHECK(child->IsTableCaption()); |
685 } | 703 } |
686 } | 704 } |
| 705 // Reset these so they don't affect the layout of footers or captions. |
| 706 state.SetHeightOffsetForTableHeaders(LayoutUnit()); |
| 707 state.SetHeightOffsetForTableFooters(LayoutUnit()); |
687 | 708 |
688 // Lay out table footer. | 709 // Lay out table footer. |
689 if (LayoutTableSection* section = Footer()) { | 710 if (LayoutTableSection* section = Footer()) { |
690 LayoutSection(*section, layouter, section_logical_left, | 711 LayoutSection(*section, layouter, section_logical_left, |
691 table_height_changing); | 712 table_height_changing); |
692 } | 713 } |
693 | 714 |
694 SetLogicalHeight(table_box_logical_top + border_and_padding_before); | 715 SetLogicalHeight(table_box_logical_top + border_and_padding_before); |
695 | 716 |
696 LayoutUnit computed_logical_height = LogicalHeightFromStyle(); | 717 LayoutUnit computed_logical_height = LogicalHeightFromStyle(); |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 collapsed_outer_borders_valid_ = true; | 1629 collapsed_outer_borders_valid_ = true; |
1609 if (ShouldCollapseBorders()) { | 1630 if (ShouldCollapseBorders()) { |
1610 collapsed_outer_border_before_ = ComputeCollapsedOuterBorderBefore(); | 1631 collapsed_outer_border_before_ = ComputeCollapsedOuterBorderBefore(); |
1611 collapsed_outer_border_after_ = ComputeCollapsedOuterBorderAfter(); | 1632 collapsed_outer_border_after_ = ComputeCollapsedOuterBorderAfter(); |
1612 collapsed_outer_border_start_ = ComputeCollapsedOuterBorderStart(); | 1633 collapsed_outer_border_start_ = ComputeCollapsedOuterBorderStart(); |
1613 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd(); | 1634 collapsed_outer_border_end_ = ComputeCollapsedOuterBorderEnd(); |
1614 } | 1635 } |
1615 } | 1636 } |
1616 | 1637 |
1617 } // namespace blink | 1638 } // namespace blink |
OLD | NEW |