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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore); | 614 setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore); |
615 | 615 |
616 LayoutUnit sectionLogicalLeft = LayoutUnit( | 616 LayoutUnit sectionLogicalLeft = LayoutUnit( |
617 style()->isLeftToRightDirection() ? borderStart() : borderEnd()); | 617 style()->isLeftToRightDirection() ? borderStart() : borderEnd()); |
618 if (!collapsing) { | 618 if (!collapsing) { |
619 sectionLogicalLeft += | 619 sectionLogicalLeft += |
620 style()->isLeftToRightDirection() ? paddingStart() : paddingEnd(); | 620 style()->isLeftToRightDirection() ? paddingStart() : paddingEnd(); |
621 } | 621 } |
622 | 622 |
623 // Lay out table header group. | 623 // Lay out table header group. |
624 if (LayoutTableSection* section = header()) | 624 if (LayoutTableSection* section = header()) { |
625 layoutSection(*section, layouter, sectionLogicalLeft); | 625 layoutSection(*section, layouter, sectionLogicalLeft); |
| 626 if (state.isPaginated()) { |
| 627 // If the repeating header group allows at least one row of content, |
| 628 // then store the offset for other sections to offset their rows |
| 629 // against. |
| 630 LayoutUnit sectionLogicalHeight = section->logicalHeight(); |
| 631 if (sectionLogicalHeight < |
| 632 section->pageLogicalHeightForOffset(section->logicalTop()) && |
| 633 section->getPaginationBreakability() != AllowAnyBreaks) { |
| 634 LayoutUnit offsetForTableHeaders = |
| 635 state.heightOffsetForTableHeaders(); |
| 636 // Don't include any strut in the header group - we only want the |
| 637 // height from its content. |
| 638 offsetForTableHeaders += sectionLogicalHeight; |
| 639 if (LayoutTableRow* row = section->firstRow()) |
| 640 offsetForTableHeaders -= row->paginationStrut(); |
| 641 section->setOffsetForRepeatingHeader( |
| 642 state.heightOffsetForTableHeaders()); |
| 643 state.setHeightOffsetForTableHeaders(offsetForTableHeaders); |
| 644 } |
| 645 } |
| 646 } |
626 | 647 |
627 // Lay out table body groups, and column groups. | 648 // Lay out table body groups, and column groups. |
628 for (LayoutObject* child = firstChild(); child; | 649 for (LayoutObject* child = firstChild(); child; |
629 child = child->nextSibling()) { | 650 child = child->nextSibling()) { |
630 if (child->isTableSection()) { | 651 if (child->isTableSection()) { |
631 if (child != header() && child != footer()) { | 652 if (child != header() && child != footer()) { |
632 LayoutTableSection& section = *toLayoutTableSection(child); | 653 LayoutTableSection& section = *toLayoutTableSection(child); |
633 layoutSection(section, layouter, sectionLogicalLeft); | 654 layoutSection(section, layouter, sectionLogicalLeft); |
634 } | 655 } |
635 } else if (child->isLayoutTableCol()) { | 656 } else if (child->isLayoutTableCol()) { |
(...skipping 15 matching lines...) Expand all Loading... |
651 totalSectionLogicalHeight = | 672 totalSectionLogicalHeight = |
652 bottomSection->logicalBottom() - topSection->logicalTop(); | 673 bottomSection->logicalBottom() - topSection->logicalTop(); |
653 } | 674 } |
654 | 675 |
655 if (!state.isPaginated() || | 676 if (!state.isPaginated() || |
656 !crossesPageBoundary(tableBoxLogicalTop, computedLogicalHeight)) { | 677 !crossesPageBoundary(tableBoxLogicalTop, computedLogicalHeight)) { |
657 distributeExtraLogicalHeight( | 678 distributeExtraLogicalHeight( |
658 floorToInt(computedLogicalHeight - totalSectionLogicalHeight)); | 679 floorToInt(computedLogicalHeight - totalSectionLogicalHeight)); |
659 } | 680 } |
660 | 681 |
661 bool isPaginated = view()->layoutState()->isPaginated(); | |
662 LayoutUnit logicalOffset = | 682 LayoutUnit logicalOffset = |
663 topSection ? topSection->logicalTop() : LayoutUnit(); | 683 topSection ? topSection->logicalTop() : LayoutUnit(); |
664 for (LayoutTableSection* section = topSection; section; | 684 for (LayoutTableSection* section = topSection; section; |
665 section = sectionBelow(section)) { | 685 section = sectionBelow(section)) { |
666 section->setLogicalTop(logicalOffset); | 686 section->setLogicalTop(logicalOffset); |
667 section->layoutRows(); | 687 section->layoutRows(); |
668 logicalOffset += section->logicalHeight(); | 688 logicalOffset += section->logicalHeight(); |
669 // If the section is a repeating header group that allows at least one row | |
670 // of content then store the offset for other sections to offset their | |
671 // rows against. | |
672 if (isPaginated && m_head && m_head == section && | |
673 section->logicalHeight() < | |
674 section->pageLogicalHeightForOffset(logicalOffset) && | |
675 section->getPaginationBreakability() != LayoutBox::AllowAnyBreaks) { | |
676 LayoutUnit offsetForTableHeaders = state.heightOffsetForTableHeaders(); | |
677 // Don't include any strut in the header group - we only want the height | |
678 // from its content. | |
679 offsetForTableHeaders += section->logicalHeight(); | |
680 if (LayoutTableRow* row = section->firstRow()) | |
681 offsetForTableHeaders -= row->paginationStrut(); | |
682 state.setHeightOffsetForTableHeaders(offsetForTableHeaders); | |
683 } | |
684 } | 689 } |
685 | 690 |
686 if (!topSection && computedLogicalHeight > totalSectionLogicalHeight && | 691 if (!topSection && computedLogicalHeight > totalSectionLogicalHeight && |
687 !document().inQuirksMode()) { | 692 !document().inQuirksMode()) { |
688 // Completely empty tables (with no sections or anything) should at least | 693 // Completely empty tables (with no sections or anything) should at least |
689 // honor specified height in strict mode. | 694 // honor specified height in strict mode. |
690 setLogicalHeight(logicalHeight() + computedLogicalHeight); | 695 setLogicalHeight(logicalHeight() + computedLogicalHeight); |
691 } | 696 } |
692 | 697 |
693 // position the table sections | 698 // position the table sections |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 } | 1691 } |
1687 | 1692 |
1688 LayoutUnit LayoutTable::paddingRight() const { | 1693 LayoutUnit LayoutTable::paddingRight() const { |
1689 if (collapseBorders()) | 1694 if (collapseBorders()) |
1690 return LayoutUnit(); | 1695 return LayoutUnit(); |
1691 | 1696 |
1692 return LayoutBlock::paddingRight(); | 1697 return LayoutBlock::paddingRight(); |
1693 } | 1698 } |
1694 | 1699 |
1695 } // namespace blink | 1700 } // namespace blink |
OLD | NEW |