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

Unified Diff: Source/core/rendering/RenderTableSection.cpp

Issue 23526051: Optimize number of rowspan cells required to distribute their height in rows. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTableSection.cpp
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index da4b53a56e5c1fb5c6908e7bd47bd46eca864cab..b49f47f6987963472b955849aa78f06dab026038 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -528,6 +528,9 @@ int RenderTableSection::calcRowLogicalHeight()
m_rowPos[0] = 0;
SpanningRenderTableCells rowSpanCells;
+#ifndef NDEBUG
+ HashSet<const RenderTableCell*> uniqueCells;
+#endif
for (unsigned r = 0; r < m_grid.size(); r++) {
m_grid[r].baseline = 0;
@@ -538,6 +541,7 @@ int RenderTableSection::calcRowLogicalHeight()
Row& row = m_grid[r].row;
unsigned totalCols = row.size();
+ RenderTableCell* lastRowSpanCell = 0;
for (unsigned c = 0; c < totalCols; c++) {
CellStruct& current = cellAt(r, c);
@@ -549,8 +553,14 @@ int RenderTableSection::calcRowLogicalHeight()
if (RuntimeEnabledFeatures::rowSpanLogicalHeightSpreadingEnabled()) {
if (cell->rowSpan() > 1) {
// For row spanning cells, we only handle them for the first row they span. This ensures we take their baseline into account.
- if (cell->rowIndex() == r) {
+ if (lastRowSpanCell != cell && cell->rowIndex() == r) {
+#ifndef NDEBUG
+ ASSERT(!uniqueCells.contains(cell));
+ uniqueCells.add(cell);
+#endif
+
rowSpanCells.append(cell);
+ lastRowSpanCell = cell;
// Find out the baseline. The baseline is set on the first row in a rowSpan.
updateBaselineForCell(cell, r, baselineDescent);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698