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

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

Issue 2021703002: Display table header groups at the top of each page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 6 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, 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 977 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
978 int paginationStrutOnRow = 0; 978 int paginationStrutOnRow = 0;
979 if (rowLayoutObject) { 979 if (rowLayoutObject) {
980 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 980 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
981 rowLayoutObject->setLogicalWidth(logicalWidth()); 981 rowLayoutObject->setLogicalWidth(logicalWidth());
982 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing)); 982 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
983 rowLayoutObject->updateLayerTransformAfterLayout(); 983 rowLayoutObject->updateLayerTransformAfterLayout();
984 if (isPaginated) { 984 if (isPaginated) {
985 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r])); 985 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r]));
986 if (paginationStrutOnRow) { 986 if (paginationStrutOnRow) {
987 LayoutTableSection* header = table()->header();
988 // If we have a header group we will paint it at the top of each page, move the rows
989 // down to accomodate it.
990 if (header && header != this)
991 paginationStrutOnRow += header->logicalHeight().toInt();
987 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +) 992 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +)
988 m_rowPos[rowIndex] += paginationStrutOnRow; 993 m_rowPos[rowIndex] += paginationStrutOnRow;
989 } 994 }
990 } 995 }
991 } 996 }
992 997
993 int rowHeightIncreaseForPagination = INT_MIN; 998 int rowHeightIncreaseForPagination = INT_MIN;
994 999
995 for (unsigned c = 0; c < nEffCols; c++) { 1000 for (unsigned c = 0; c < nEffCols; c++) {
996 CellStruct& cs = cellAt(r, c); 1001 CellStruct& cs = cellAt(r, c);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 1109
1105 ASSERT(!needsLayout()); 1110 ASSERT(!needsLayout());
1106 1111
1107 setLogicalHeight(LayoutUnit(m_rowPos[totalRows])); 1112 setLogicalHeight(LayoutUnit(m_rowPos[totalRows]));
1108 1113
1109 computeOverflowFromCells(totalRows, nEffCols); 1114 computeOverflowFromCells(totalRows, nEffCols);
1110 } 1115 }
1111 1116
1112 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const 1117 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const
1113 { 1118 {
1114 if (row->getPaginationBreakability() == AllowAnyBreaks) 1119 // Even if the row allows us to break-inside, we will want to put a strut on the row if we have a header
1120 // group that wants to appear at the top of each page.
1121 bool tableHeaderForcesStrut = table()->header() ? table()->header()->getPagi nationBreakability() != AllowAnyBreaks : false;
1122 if (row->getPaginationBreakability() == AllowAnyBreaks && !tableHeaderForces Strut)
1115 return 0; 1123 return 0;
1116 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 1124 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
1117 if (!pageLogicalHeight) 1125 if (!pageLogicalHeight)
1118 return 0; 1126 return 0;
1119 // If the row is too tall for the page don't insert a strut. 1127 // If the row is too tall for the page don't insert a strut.
1120 LayoutUnit rowLogicalHeight = row->logicalHeight(); 1128 LayoutUnit rowLogicalHeight = row->logicalHeight();
1121 if (rowLogicalHeight > pageLogicalHeight) 1129 if (rowLogicalHeight > pageLogicalHeight)
1122 return 0; 1130 return 0;
1123 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage); 1131 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage);
1124 if (remainingLogicalHeight >= rowLogicalHeight) 1132 if (remainingLogicalHeight >= rowLogicalHeight)
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1679 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1672 if (!style()->isLeftToRightDirection()) 1680 if (!style()->isLeftToRightDirection())
1673 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1681 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1674 else 1682 else
1675 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1683 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1676 1684
1677 cell->setLogicalLocation(cellLocation); 1685 cell->setLogicalLocation(cellLocation);
1678 } 1686 }
1679 1687
1680 } // namespace blink 1688 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/paint/TableSectionPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698