| OLD | NEW |
| 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. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 rowLogicalHeight -= nextRowObject->paginationStrut(); | 1136 rowLogicalHeight -= nextRowObject->paginationStrut(); |
| 1137 } | 1137 } |
| 1138 rowLayoutObject->setLogicalHeight(rowLogicalHeight); | 1138 rowLayoutObject->setLogicalHeight(rowLogicalHeight); |
| 1139 rowLayoutObject->updateLayerTransformAfterLayout(); | 1139 rowLayoutObject->updateLayerTransformAfterLayout(); |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 // Vertically align and flex the cells in each row. | 1143 // Vertically align and flex the cells in each row. |
| 1144 for (unsigned r = 0; r < totalRows; r++) { | 1144 for (unsigned r = 0; r < totalRows; r++) { |
| 1145 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; | 1145 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; |
| 1146 int rowHeightIncreaseForPagination = INT_MIN; | |
| 1147 | 1146 |
| 1148 for (unsigned c = 0; c < nEffCols; c++) { | 1147 for (unsigned c = 0; c < nEffCols; c++) { |
| 1149 CellStruct& cs = cellAt(r, c); | 1148 CellStruct& cs = cellAt(r, c); |
| 1150 LayoutTableCell* cell = cs.primaryCell(); | 1149 LayoutTableCell* cell = cs.primaryCell(); |
| 1151 | 1150 |
| 1152 if (!cell || cs.inColSpan) | 1151 if (!cell || cs.inColSpan) |
| 1153 continue; | 1152 continue; |
| 1154 | 1153 |
| 1155 if (cell->rowIndex() != r) | 1154 if (cell->rowIndex() != r) |
| 1156 continue; // Rowspanned cells are handled in the first row they occur. | 1155 continue; // Rowspanned cells are handled in the first row they occur. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1187 | 1186 |
| 1188 LayoutRect oldCellRect = cell->frameRect(); | 1187 LayoutRect oldCellRect = cell->frameRect(); |
| 1189 | 1188 |
| 1190 setLogicalPositionForCell(cell, c); | 1189 setLogicalPositionForCell(cell, c); |
| 1191 | 1190 |
| 1192 if (!cell->needsLayout()) | 1191 if (!cell->needsLayout()) |
| 1193 markChildForPaginationRelayoutIfNeeded(*cell, layouter); | 1192 markChildForPaginationRelayoutIfNeeded(*cell, layouter); |
| 1194 | 1193 |
| 1195 cell->layoutIfNeeded(); | 1194 cell->layoutIfNeeded(); |
| 1196 | 1195 |
| 1197 // FIXME: Make pagination work with vertical tables. | |
| 1198 if (view()->layoutState()->pageLogicalHeight() && | |
| 1199 cell->logicalHeight() != rHeight) { | |
| 1200 // FIXME: Pagination might have made us change size. For now just shrink | |
| 1201 // or grow the cell to fit without doing a relayout. | |
| 1202 // We'll also do a basic increase of the row height to accommodate the | |
| 1203 // cell if it's bigger, but this isn't quite right either. It's at least | |
| 1204 // stable though and won't result in an infinite # of relayouts that may | |
| 1205 // never stabilize. | |
| 1206 LayoutUnit oldLogicalHeight = cell->logicalHeight(); | |
| 1207 rowHeightIncreaseForPagination = | |
| 1208 std::max<int>(rowHeightIncreaseForPagination, | |
| 1209 (oldLogicalHeight - rHeight).toInt()); | |
| 1210 cell->setLogicalHeight(LayoutUnit(rHeight)); | |
| 1211 cell->computeOverflow(oldLogicalHeight, false); | |
| 1212 } | |
| 1213 | |
| 1214 LayoutSize childOffset(cell->location() - oldCellRect.location()); | 1196 LayoutSize childOffset(cell->location() - oldCellRect.location()); |
| 1215 if (childOffset.width() || childOffset.height()) { | 1197 if (childOffset.width() || childOffset.height()) { |
| 1216 // If the child moved, we have to issue paint invalidations to it as | 1198 // If the child moved, we have to issue paint invalidations to it as |
| 1217 // well as any floating/positioned descendants. An exception is if we | 1199 // well as any floating/positioned descendants. An exception is if we |
| 1218 // need a layout. In this case, we know we're going to issue paint | 1200 // need a layout. In this case, we know we're going to issue paint |
| 1219 // invalidations ourselves (and the child) anyway. | 1201 // invalidations ourselves (and the child) anyway. |
| 1220 if (!table()->selfNeedsLayout()) | 1202 if (!table()->selfNeedsLayout()) |
| 1221 cell->setMayNeedPaintInvalidation(); | 1203 cell->setMayNeedPaintInvalidation(); |
| 1222 } | 1204 } |
| 1223 } | 1205 } |
| 1224 if (rowHeightIncreaseForPagination > INT_MIN) { | |
| 1225 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) | |
| 1226 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; | |
| 1227 for (unsigned c = 0; c < nEffCols; ++c) { | |
| 1228 Vector<LayoutTableCell*, 1>& cells = cellAt(r, c).cells; | |
| 1229 for (size_t i = 0; i < cells.size(); ++i) { | |
| 1230 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); | |
| 1231 cells[i]->setLogicalHeight(oldLogicalHeight + | |
| 1232 rowHeightIncreaseForPagination); | |
| 1233 cells[i]->computeOverflow(oldLogicalHeight, false); | |
| 1234 } | |
| 1235 } | |
| 1236 } | |
| 1237 if (rowLayoutObject) | 1206 if (rowLayoutObject) |
| 1238 rowLayoutObject->computeOverflow(); | 1207 rowLayoutObject->computeOverflow(); |
| 1239 } | 1208 } |
| 1240 | 1209 |
| 1241 ASSERT(!needsLayout()); | 1210 ASSERT(!needsLayout()); |
| 1242 | 1211 |
| 1243 setLogicalHeight(LayoutUnit(m_rowPos[totalRows])); | 1212 setLogicalHeight(LayoutUnit(m_rowPos[totalRows])); |
| 1244 | 1213 |
| 1245 computeOverflowFromCells(totalRows, nEffCols); | 1214 computeOverflowFromCells(totalRows, nEffCols); |
| 1246 } | 1215 } |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 // the header in all columns. | 2043 // the header in all columns. |
| 2075 // Note that this is in flow thread coordinates, not visual coordinates. The | 2044 // Note that this is in flow thread coordinates, not visual coordinates. The |
| 2076 // enclosing LayoutFlowThread will convert to visual coordinates. | 2045 // enclosing LayoutFlowThread will convert to visual coordinates. |
| 2077 if (table()->header() == this && isRepeatingHeaderGroup()) | 2046 if (table()->header() == this && isRepeatingHeaderGroup()) |
| 2078 rect.setHeight(table()->logicalHeight()); | 2047 rect.setHeight(table()->logicalHeight()); |
| 2079 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, | 2048 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, |
| 2080 flags); | 2049 flags); |
| 2081 } | 2050 } |
| 2082 | 2051 |
| 2083 } // namespace blink | 2052 } // namespace blink |
| OLD | NEW |