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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTable.cpp

Issue 2882043002: Update our treatment of repeating headers in tables (Closed)
Patch Set: bug 720620 Created 3 years, 7 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 LayoutUnit logical_left, 463 LayoutUnit logical_left,
464 TableHeightChangingValue table_height_changing) { 464 TableHeightChangingValue table_height_changing) {
465 section.SetLogicalLocation(LayoutPoint(logical_left, LogicalHeight())); 465 section.SetLogicalLocation(LayoutPoint(logical_left, LogicalHeight()));
466 if (column_logical_width_changed_) 466 if (column_logical_width_changed_)
467 layouter.SetChildNeedsLayout(&section); 467 layouter.SetChildNeedsLayout(&section);
468 if (!section.NeedsLayout()) 468 if (!section.NeedsLayout())
469 MarkChildForPaginationRelayoutIfNeeded(section, layouter); 469 MarkChildForPaginationRelayoutIfNeeded(section, layouter);
470 bool needed_layout = section.NeedsLayout(); 470 bool needed_layout = section.NeedsLayout();
471 if (needed_layout) 471 if (needed_layout)
472 section.UpdateLayout(); 472 section.UpdateLayout();
473 if (needed_layout || table_height_changing == kTableHeightChanging) 473 if (needed_layout || table_height_changing == kTableHeightChanging) {
474 section.SetLogicalHeight(LayoutUnit(section.CalcRowLogicalHeight())); 474 section.SetLogicalHeight(LayoutUnit(section.CalcRowLogicalHeight()));
475 section.SetHeaderGroupShouldRepeat();
476 }
475 477
476 if (View()->GetLayoutState()->IsPaginated()) 478 if (View()->GetLayoutState()->IsPaginated())
477 UpdateFragmentationInfoForChild(section); 479 UpdateFragmentationInfoForChild(section);
478 SetLogicalHeight(LogicalHeight() + section.LogicalHeight()); 480 SetLogicalHeight(LogicalHeight() + section.LogicalHeight());
479 } 481 }
480 482
481 LayoutUnit LayoutTable::LogicalHeightFromStyle() const { 483 LayoutUnit LayoutTable::LogicalHeightFromStyle() const {
482 LayoutUnit computed_logical_height; 484 LayoutUnit computed_logical_height;
483 Length logical_height_length = Style()->LogicalHeight(); 485 Length logical_height_length = Style()->LogicalHeight();
484 if (logical_height_length.IsIntrinsic() || 486 if (logical_height_length.IsIntrinsic() ||
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 old_available_logical_height_ = current_available_logical_height; 656 old_available_logical_height_ = current_available_logical_height;
655 657
656 // Lay out table header group. 658 // Lay out table header group.
657 if (LayoutTableSection* section = Header()) { 659 if (LayoutTableSection* section = Header()) {
658 LayoutSection(*section, layouter, section_logical_left, 660 LayoutSection(*section, layouter, section_logical_left,
659 table_height_changing); 661 table_height_changing);
660 if (state.IsPaginated()) { 662 if (state.IsPaginated()) {
661 // If the repeating header group allows at least one row of content, 663 // If the repeating header group allows at least one row of content,
662 // then store the offset for other sections to offset their rows 664 // then store the offset for other sections to offset their rows
663 // against. 665 // against.
664 LayoutUnit section_logical_height = section->LogicalHeight(); 666 if (section->IsRepeatingHeaderGroup()) {
665 if (section_logical_height < 667 LayoutUnit offset_for_table_headers =
666 section->PageLogicalHeightForOffset(section->LogicalTop()) && 668 state.HeightOffsetForTableHeaders();
667 section->GetPaginationBreakability() != kAllowAnyBreaks) { 669 offset_for_table_headers += section->LogicalHeight();
mstensho (USE GERRIT) 2017/05/22 10:40:44 So here we are re-introducing support for nested r
rhogan 2017/05/22 18:06:04 I think the spec implies it now (by allowing you t
mstensho (USE GERRIT) 2017/05/22 19:17:34 Thanks for the clarification. I agree that support
668 // Don't include any strut in the header group - we only want the 670 // Don't include any strut in the header group - we only want the
669 // height from its content. 671 // height from its content.
670 LayoutUnit offset_for_table_headers = section_logical_height;
671 if (LayoutTableRow* row = section->FirstRow()) 672 if (LayoutTableRow* row = section->FirstRow())
672 offset_for_table_headers -= row->PaginationStrut(); 673 offset_for_table_headers -= row->PaginationStrut();
674 state.SetHeightOffsetForTableHeaders(offset_for_table_headers);
673 SetRowOffsetFromRepeatingHeader(offset_for_table_headers); 675 SetRowOffsetFromRepeatingHeader(offset_for_table_headers);
674 } 676 }
675 } 677 }
676 } 678 }
677 679
678 // Lay out table body groups, and column groups. 680 // Lay out table body groups, and column groups.
679 for (LayoutObject* child = FirstChild(); child; 681 for (LayoutObject* child = FirstChild(); child;
680 child = child->NextSibling()) { 682 child = child->NextSibling()) {
681 if (child->IsTableSection()) { 683 if (child->IsTableSection()) {
682 if (child != Header() && child != Footer()) { 684 if (child != Header() && child != Footer()) {
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 } 1762 }
1761 1763
1762 LayoutUnit LayoutTable::PaddingRight() const { 1764 LayoutUnit LayoutTable::PaddingRight() const {
1763 if (ShouldCollapseBorders()) 1765 if (ShouldCollapseBorders())
1764 return LayoutUnit(); 1766 return LayoutUnit();
1765 1767
1766 return LayoutBlock::PaddingRight(); 1768 return LayoutBlock::PaddingRight();
1767 } 1769 }
1768 1770
1769 } // namespace blink 1771 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698