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

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

Issue 744493002: Let RenderTable reach table cells needing overflow recalc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Avoid O(rows*cols) Created 6 years, 1 month 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
Index: Source/core/rendering/RenderTableSection.cpp
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index f1983f60442b97de4e318913bdadcee70a486cf4..f8aa599b4421cf245f8b62bef90c2ee6923e0682 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -943,9 +943,6 @@ void RenderTableSection::layoutRows()
// Set the width of our section now. The rows will also be this width.
setLogicalWidth(table()->contentLogicalWidth());
- m_overflow.clear();
- m_overflowingCells.clear();
- m_forceSlowPaintPathWithOverflowingCell = false;
int vspacing = table()->vBorderSpacing();
unsigned nEffCols = table()->numEffCols();
@@ -960,8 +957,6 @@ void RenderTableSection::layoutRows()
rowRenderer->setLogicalWidth(logicalWidth());
rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
rowRenderer->updateLayerTransformAfterLayout();
- rowRenderer->clearAllOverflows();
- rowRenderer->addVisualEffectOverflow();
}
int rowHeightIncreaseForPagination = 0;
@@ -1053,9 +1048,6 @@ void RenderTableSection::layoutRows()
cell->computeOverflow(oldLogicalHeight, false);
}
- if (rowRenderer)
- rowRenderer->addOverflowFromCell(cell);
-
LayoutSize childOffset(cell->location() - oldCellRect.location());
if (childOffset.width() || childOffset.height()) {
// If the child moved, we have to issue paint invalidations to it as well as any floating/positioned
@@ -1098,11 +1090,21 @@ void RenderTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n
unsigned totalCellsCount = nEffCols * totalRows;
unsigned maxAllowedOverflowingCellsCount = totalCellsCount < gMinTableSizeToUseFastPaintPathWithOverflowingCell ? 0 : gMaxAllowedOverflowingCellRatioForFastPaintPath * totalCellsCount;
+ m_overflow.clear();
+ m_overflowingCells.clear();
Julien - ping for review 2014/11/25 18:33:10 We were clearing the overflowing cells early to mi
Xianzhu 2014/11/25 20:17:12 Restored the original one.
+ m_forceSlowPaintPathWithOverflowingCell = false;
+
#if ENABLE(ASSERT)
bool hasOverflowingCell = false;
#endif
// Now that our height has been determined, add in overflow from cells.
for (unsigned r = 0; r < totalRows; r++) {
+ RenderTableRow* rowRenderer = rowRendererAt(r);
+ if (rowRenderer) {
+ rowRenderer->clearAllOverflows();
+ rowRenderer->addVisualEffectOverflow();
+ }
+
for (unsigned c = 0; c < nEffCols; c++) {
CellStruct& cs = cellAt(r, c);
RenderTableCell* cell = cs.primaryCell();
@@ -1114,6 +1116,10 @@ void RenderTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n
#if ENABLE(ASSERT)
hasOverflowingCell |= cell->hasVisualOverflow();
#endif
+
+ if (rowRenderer)
+ rowRenderer->addOverflowFromCell(cell);
+
if (cell->hasVisualOverflow() && !m_forceSlowPaintPathWithOverflowingCell) {
m_overflowingCells.add(cell);
if (m_overflowingCells.size() > maxAllowedOverflowingCellsCount) {
@@ -1129,6 +1135,38 @@ void RenderTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n
ASSERT(hasOverflowingCell == this->hasOverflowingCell());
}
+bool RenderTableSection::recalcChildOverflowAfterStyleChange()
+{
+ ASSERT(childNeedsOverflowRecalcAfterStyleChange());
+ clearChildNeedsOverflowRecalcAfterStyleChange();
+
+ unsigned totalRows = m_grid.size();
+ unsigned numEffCols = table()->numEffCols();
+ bool childrenOverflowChanged = false;
+
+ for (unsigned r = 0; r < totalRows; r++) {
+ RenderTableRow* rowRenderer = rowRendererAt(r);
+ if (!rowRenderer || !rowRenderer->childNeedsOverflowRecalcAfterStyleChange())
+ continue;
+
+ rowRenderer->clearChildNeedsOverflowRecalcAfterStyleChange();
+
+ for (unsigned c = 0; c < numEffCols; c++) {
+ CellStruct& cs = cellAt(r, c);
+ RenderTableCell* cell = cs.primaryCell();
+ if (!cell || cs.inColSpan || !cell->needsOverflowRecalcAfterStyleChange())
+ continue;
+ if (cell->recalcOverflowAfterStyleChange())
+ childrenOverflowChanged = true;
+ }
+ }
+
+ if (childrenOverflowChanged)
+ computeOverflowFromCells(totalRows, numEffCols);
+
+ return childrenOverflowChanged;
+}
+
int RenderTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) const
{
unsigned totalCols = table()->numEffCols();
« Source/core/rendering/RenderTable.cpp ('K') | « Source/core/rendering/RenderTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698