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

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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 974 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
975 int paginationStrutOnRow = 0; 975 int paginationStrutOnRow = 0;
976 if (rowLayoutObject) { 976 if (rowLayoutObject) {
977 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 977 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
978 rowLayoutObject->setLogicalWidth(logicalWidth()); 978 rowLayoutObject->setLogicalWidth(logicalWidth());
979 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing)); 979 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
980 rowLayoutObject->updateLayerTransformAfterLayout(); 980 rowLayoutObject->updateLayerTransformAfterLayout();
981 if (isPaginated) { 981 if (isPaginated) {
982 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r])); 982 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r]));
983 if (paginationStrutOnRow) { 983 if (paginationStrutOnRow) {
984 LayoutTableSection* header = table()->header();
985 // If we have a header group we will paint it at the top of each page, move the rows
986 // down to accomodate it.
987 if (header && header != this)
988 paginationStrutOnRow += header->logicalHeight().toInt();
984 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +) 989 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +)
985 m_rowPos[rowIndex] += paginationStrutOnRow; 990 m_rowPos[rowIndex] += paginationStrutOnRow;
986 } 991 }
987 } 992 }
988 } 993 }
989 994
990 int rowHeightIncreaseForPagination = INT_MIN; 995 int rowHeightIncreaseForPagination = INT_MIN;
991 996
992 for (unsigned c = 0; c < nEffCols; c++) { 997 for (unsigned c = 0; c < nEffCols; c++) {
993 CellStruct& cs = cellAt(r, c); 998 CellStruct& cs = cellAt(r, c);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1106
1102 ASSERT(!needsLayout()); 1107 ASSERT(!needsLayout());
1103 1108
1104 setLogicalHeight(LayoutUnit(m_rowPos[totalRows])); 1109 setLogicalHeight(LayoutUnit(m_rowPos[totalRows]));
1105 1110
1106 computeOverflowFromCells(totalRows, nEffCols); 1111 computeOverflowFromCells(totalRows, nEffCols);
1107 } 1112 }
1108 1113
1109 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const 1114 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const
1110 { 1115 {
1111 if (row->getPaginationBreakability() == AllowAnyBreaks) 1116 // Even if the row allows us to break-inside, we will want to put a strut on the row if we have a header
1117 // group that wants to appear at the top of each page.
1118 bool tableHeaderForcesStrut = table()->header() ? table()->header()->getPagi nationBreakability() != AllowAnyBreaks : false;
1119 if (row->getPaginationBreakability() == AllowAnyBreaks && !tableHeaderForces Strut)
1112 return 0; 1120 return 0;
1113 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 1121 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
1114 if (!pageLogicalHeight) 1122 if (!pageLogicalHeight)
1115 return 0; 1123 return 0;
1116 // If the row is too tall for the page don't insert a strut. 1124 // If the row is too tall for the page don't insert a strut.
1117 LayoutUnit rowLogicalHeight = row->logicalHeight(); 1125 LayoutUnit rowLogicalHeight = row->logicalHeight();
1118 if (rowLogicalHeight > pageLogicalHeight) 1126 if (rowLogicalHeight > pageLogicalHeight)
1119 return 0; 1127 return 0;
1120 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage); 1128 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage);
1121 if (remainingLogicalHeight >= rowLogicalHeight) 1129 if (remainingLogicalHeight >= rowLogicalHeight)
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1676 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1669 if (!style()->isLeftToRightDirection()) 1677 if (!style()->isLeftToRightDirection())
1670 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1678 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1671 else 1679 else
1672 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1680 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1673 1681
1674 cell->setLogicalLocation(cellLocation); 1682 cell->setLogicalLocation(cellLocation);
1675 } 1683 }
1676 1684
1677 } // namespace blink 1685 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698