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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2423403002: Set logical top and height of table rows and cells in the first layout pass. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index f4681d9d0e785dc840cb607ee76a055d8a595ab2..c513b07c7b49d4b3c72eb19c6875d14b0fe21a22 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -943,6 +943,7 @@ void LayoutTableSection::layout() {
LayoutState state(*this, locationOffset());
const Vector<int>& columnPos = table()->effectiveColumnPositions();
+ LayoutUnit rowLogicalTop;
SubtreeLayoutScope layouter(*this);
for (unsigned r = 0; r < m_grid.size(); ++r) {
@@ -970,9 +971,18 @@ void LayoutTableSection::layout() {
}
if (LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject) {
- if (!rowLayoutObject->needsLayout())
- markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter);
+ if (state.isPaginated()) {
+ rowLayoutObject->setLogicalTop(rowLogicalTop);
+ if (!rowLayoutObject->needsLayout())
+ markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter);
+ }
rowLayoutObject->layoutIfNeeded();
+ if (state.isPaginated()) {
+ rowLayoutObject->setLogicalHeight(
+ LayoutUnit(logicalHeightForRow(*rowLayoutObject)));
+ rowLogicalTop = rowLayoutObject->logicalBottom();
+ rowLogicalTop += LayoutUnit(table()->vBorderSpacing());
+ }
}
}
@@ -1975,6 +1985,27 @@ void LayoutTableSection::relayoutCellIfFlexed(LayoutTableCell& cell,
}
}
+int LayoutTableSection::logicalHeightForRow(
+ const LayoutTableRow& rowObject) const {
+ unsigned rowIndex = rowObject.rowIndex();
+ int logicalHeight = 0;
+ const Row& row = m_grid[rowIndex].row;
+ unsigned cols = row.size();
+ for (unsigned colIndex = 0; colIndex < cols; colIndex++) {
+ const CellStruct& cellStruct = cellAt(rowIndex, colIndex);
+ const LayoutTableCell* cell = cellStruct.primaryCell();
+ if (!cell || cellStruct.inColSpan)
+ continue;
+ // TODO(mstensho): Rowspanned cells also need to contribute to row heights
+ // during the first layout pass, in order to get fragmentation right.
+ if (cell->rowSpan() == 1) {
+ logicalHeight =
+ std::max(logicalHeight, cell->logicalHeightForRowSizing());
+ }
+ }
+ return logicalHeight;
+}
+
bool LayoutTableSection::isRepeatingHeaderGroup() const {
if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks)
return false;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698