| Index: third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| index e7dfbd5d600d8bd73e9b0dd773b26d280807bc38..5ca2be7719aa637236317ce86f6d158ffc33be35 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| @@ -69,6 +69,7 @@ LayoutTable::LayoutTable(Element* element)
|
| border_end_(0) {
|
| DCHECK(!ChildrenInline());
|
| effective_column_positions_.Fill(0, 1);
|
| + position_of_repeating_footer_group_on_page_.Fill(LayoutUnit(), 1);
|
| }
|
|
|
| LayoutTable::~LayoutTable() {}
|
| @@ -653,6 +654,16 @@ void LayoutTable::UpdateLayout() {
|
| : kTableHeightNotChanging;
|
| old_available_logical_height_ = current_available_logical_height;
|
|
|
| + // Lay out table footer to get its raw height. This will help us decide
|
| + // if we can repeat it in each page/column.
|
| + if (LayoutTableSection* section = Footer()) {
|
| + if (section->GetPaginationBreakability() != kAllowAnyBreaks) {
|
| + section->LayoutIfNeeded();
|
| + int section_logical_height = section->CalcRowLogicalHeight();
|
| + section->SetLogicalHeight(LayoutUnit(section_logical_height));
|
| + }
|
| + }
|
| +
|
| // Lay out table header group.
|
| if (LayoutTableSection* section = Header()) {
|
| LayoutSection(*section, layouter, section_logical_left,
|
| @@ -661,13 +672,10 @@ void LayoutTable::UpdateLayout() {
|
| // If the repeating header group allows at least one row of content,
|
| // then store the offset for other sections to offset their rows
|
| // against.
|
| - LayoutUnit section_logical_height = section->LogicalHeight();
|
| - if (section_logical_height <
|
| - section->PageLogicalHeightForOffset(section->LogicalTop()) &&
|
| - section->GetPaginationBreakability() != kAllowAnyBreaks) {
|
| + if (section->IsRepeatingHeaderGroup()) {
|
| // Don't include any strut in the header group - we only want the
|
| // height from its content.
|
| - LayoutUnit offset_for_table_headers = section_logical_height;
|
| + LayoutUnit offset_for_table_headers = section->LogicalHeight();
|
| if (LayoutTableRow* row = section->FirstRow())
|
| offset_for_table_headers -= row->PaginationStrut();
|
| SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
|
| @@ -869,7 +877,8 @@ void LayoutTable::PaintObject(const PaintInfo& paint_info,
|
| TablePainter(*this).PaintObject(paint_info, paint_offset);
|
| }
|
|
|
| -void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const {
|
| +void LayoutTable::SubtractCaptionRect(LayoutRect& rect,
|
| + CaptionSelector captions) const {
|
| for (unsigned i = 0; i < captions_.size(); i++) {
|
| LayoutUnit caption_logical_height = captions_[i]->LogicalHeight() +
|
| captions_[i]->MarginBefore() +
|
| @@ -877,6 +886,8 @@ void LayoutTable::SubtractCaptionRect(LayoutRect& rect) const {
|
| bool caption_is_before =
|
| (captions_[i]->Style()->CaptionSide() != ECaptionSide::kBottom) ^
|
| Style()->IsFlippedBlocksWritingMode();
|
| + if (caption_is_before && captions == BottomCaptionsOnly)
|
| + continue;
|
| if (Style()->IsHorizontalWritingMode()) {
|
| rect.SetHeight(rect.Height() - caption_logical_height);
|
| if (caption_is_before)
|
|
|