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

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

Issue 2367243002: Don't repeat header groups when one row of content doesn't fit on the first page (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 984 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
985 int paginationStrutOnRow = 0; 985 int paginationStrutOnRow = 0;
986 if (rowLayoutObject) { 986 if (rowLayoutObject) {
987 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 987 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
988 rowLayoutObject->setLogicalWidth(logicalWidth()); 988 rowLayoutObject->setLogicalWidth(logicalWidth());
989 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing)); 989 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
990 rowLayoutObject->updateLayerTransformAfterLayout(); 990 rowLayoutObject->updateLayerTransformAfterLayout();
991 if (isPaginated) { 991 if (isPaginated) {
992 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r])); 992 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r]));
993 if (paginationStrutOnRow) { 993 if (paginationStrutOnRow) {
994 // If there isn't room for at least one content row on a pag e with a header group, then
995 // we won't repeat the header on each page.
996 if (r == 0 && table()->sectionAbove(this) == table()->header ())
997 state.setHeightOffsetForTableHeaders(state.heightOffsetF orTableHeaders() - table()->header()->logicalHeight());
994 // If we have a header group we will paint it at the top of each page, move the rows 998 // If we have a header group we will paint it at the top of each page, move the rows
995 // down to accomodate it. 999 // down to accomodate it.
996 paginationStrutOnRow += state.heightOffsetForTableHeaders(). toInt(); 1000 paginationStrutOnRow += state.heightOffsetForTableHeaders(). toInt();
997 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +) 1001 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +)
998 m_rowPos[rowIndex] += paginationStrutOnRow; 1002 m_rowPos[rowIndex] += paginationStrutOnRow;
999 } 1003 }
1000 } 1004 }
1001 } 1005 }
1002 1006
1003 int rowHeightIncreaseForPagination = INT_MIN; 1007 int rowHeightIncreaseForPagination = INT_MIN;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 bool LayoutTableSection::hasRepeatingHeaderGroup() const 1697 bool LayoutTableSection::hasRepeatingHeaderGroup() const
1694 { 1698 {
1695 if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks) 1699 if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks)
1696 return false; 1700 return false;
1697 // TODO(rhogan): Should we paint a header repeatedly if it's self-painting? 1701 // TODO(rhogan): Should we paint a header repeatedly if it's self-painting?
1698 if (hasSelfPaintingLayer()) 1702 if (hasSelfPaintingLayer())
1699 return false; 1703 return false;
1700 LayoutUnit pageHeight = table()->pageLogicalHeightForOffset(LayoutUnit()); 1704 LayoutUnit pageHeight = table()->pageLogicalHeightForOffset(LayoutUnit());
1701 if (!pageHeight) 1705 if (!pageHeight)
1702 return false; 1706 return false;
1707
1708 if (logicalHeight() > pageHeight)
1709 return false;
1710
1711 // If the first row of the section after the header group doesn't fit on the page, then
1712 // don't repeat the header on each page. See https://drafts.csswg.org/css-ta bles-3/#repeated-headers
1713 LayoutTableSection* sectionBelow = table()->sectionBelow(this);
1714 if (sectionBelow && sectionBelow->paginationStrutForRow(sectionBelow->firstR ow(), sectionBelow->logicalTop()))
1715 return false;
1716
1703 return true; 1717 return true;
1704 } 1718 }
1705 1719
1706 bool LayoutTableSection::mapToVisualRectInAncestorSpace(const LayoutBoxModelObje ct* ancestor, LayoutRect& rect, VisualRectFlags flags) const 1720 bool LayoutTableSection::mapToVisualRectInAncestorSpace(const LayoutBoxModelObje ct* ancestor, LayoutRect& rect, VisualRectFlags flags) const
1707 { 1721 {
1708 if (ancestor == this) 1722 if (ancestor == this)
1709 return true; 1723 return true;
1710 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery, 1724 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery,
1711 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns. 1725 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns.
1712 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates. 1726 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates.
1713 if (table()->header() == this && hasRepeatingHeaderGroup()) 1727 if (table()->header() == this && hasRepeatingHeaderGroup())
1714 rect.setHeight(table()->logicalHeight()); 1728 rect.setHeight(table()->logicalHeight());
1715 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags); 1729 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags);
1716 } 1730 }
1717 1731
1718 1732
1719 } // namespace blink 1733 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698