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

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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 965 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
966 int paginationStrutOnRow = 0; 966 int paginationStrutOnRow = 0;
967 if (rowLayoutObject) { 967 if (rowLayoutObject) {
968 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 968 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
969 rowLayoutObject->setLogicalWidth(logicalWidth()); 969 rowLayoutObject->setLogicalWidth(logicalWidth());
970 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing)); 970 rowLayoutObject->setLogicalHeight(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
971 rowLayoutObject->updateLayerTransformAfterLayout(); 971 rowLayoutObject->updateLayerTransformAfterLayout();
972 if (isPaginated) { 972 if (isPaginated) {
973 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r])); 973 paginationStrutOnRow = paginationStrutForRow(rowLayoutObject, La youtUnit(m_rowPos[r]));
974 if (paginationStrutOnRow) { 974 if (paginationStrutOnRow) {
975 LayoutTableSection* header = table()->header();
976 // If we have a header group we will paint it at the top of each page, move the rows
977 // down to accomodate it.
978 if (header && header != this)
979 paginationStrutOnRow += header->logicalHeight().toInt();
975 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +) 980 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex+ +)
976 m_rowPos[rowIndex] += paginationStrutOnRow; 981 m_rowPos[rowIndex] += paginationStrutOnRow;
977 } 982 }
978 } 983 }
979 } 984 }
980 985
981 int rowHeightIncreaseForPagination = INT_MIN; 986 int rowHeightIncreaseForPagination = INT_MIN;
982 987
983 for (unsigned c = 0; c < nEffCols; c++) { 988 for (unsigned c = 0; c < nEffCols; c++) {
984 CellStruct& cs = cellAt(r, c); 989 CellStruct& cs = cellAt(r, c);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1097
1093 ASSERT(!needsLayout()); 1098 ASSERT(!needsLayout());
1094 1099
1095 setLogicalHeight(LayoutUnit(m_rowPos[totalRows])); 1100 setLogicalHeight(LayoutUnit(m_rowPos[totalRows]));
1096 1101
1097 computeOverflowFromCells(totalRows, nEffCols); 1102 computeOverflowFromCells(totalRows, nEffCols);
1098 } 1103 }
1099 1104
1100 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const 1105 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row, LayoutUnit lo gicalOffset) const
1101 { 1106 {
1102 if (row->getPaginationBreakability() == AllowAnyBreaks) 1107 // Even if the row allows us to break-inside, we will want to put a strut on the row if we have a header
1108 // group that wants to appear at the top of each page.
1109 bool tableHeaderForcesStrut = table()->header() ? table()->header()->getPagi nationBreakability() != AllowAnyBreaks : false;
1110 if (row->getPaginationBreakability() == AllowAnyBreaks && !tableHeaderForces Strut)
1103 return 0; 1111 return 0;
1104 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 1112 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
1105 if (!pageLogicalHeight) 1113 if (!pageLogicalHeight)
1106 return 0; 1114 return 0;
1107 // If the row is too tall for the page don't insert a strut. 1115 // If the row is too tall for the page don't insert a strut.
1108 LayoutUnit rowLogicalHeight = row->logicalHeight(); 1116 LayoutUnit rowLogicalHeight = row->logicalHeight();
1109 if (rowLogicalHeight > pageLogicalHeight) 1117 if (rowLogicalHeight > pageLogicalHeight)
1110 return 0; 1118 return 0;
1111 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage); 1119 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage);
1112 if (remainingLogicalHeight >= rowLogicalHeight) 1120 if (remainingLogicalHeight >= rowLogicalHeight)
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1663 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1656 if (!style()->isLeftToRightDirection()) 1664 if (!style()->isLeftToRightDirection())
1657 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1665 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1658 else 1666 else
1659 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1667 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1660 1668
1661 cell->setLogicalLocation(cellLocation); 1669 cell->setLogicalLocation(cellLocation);
1662 } 1670 }
1663 1671
1664 } // namespace blink 1672 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698