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

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

Issue 2548333003: Revert of Paint collapsed borders of a table as one display item (Closed)
Patch Set: Created 4 years 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: third_party/WebKit/Source/core/layout/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 55423926bcf79a6fe4f08a1a8bacd659ccde60d9..cb63f2ce4c19a644549fe31cf549e17cdc7e5c95 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -99,8 +99,7 @@
// If border was changed, invalidate collapsed borders cache.
if (!needsLayout() && oldStyle && oldStyle->border() != style()->border())
- invalidateCollapsedBorders(PaintInvalidationStyleChange);
-
+ invalidateCollapsedBorders();
if (LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *this, diff,
*oldStyle))
markAllCellsWidthsDirtyAndOrNeedsLayout(MarkDirtyAndNeedsLayout);
@@ -733,7 +732,7 @@
updateLayerTransformAfterLayout();
// Layout was changed, so probably borders too.
- invalidateCollapsedBorders(PaintInvalidationForcedByLayout);
+ invalidateCollapsedBorders();
computeOverflow(clientLogicalBottom());
updateAfterLayout();
@@ -752,19 +751,13 @@
clearNeedsLayout();
}
-void LayoutTable::invalidateCollapsedBorders(PaintInvalidationReason reason) {
- DCHECK(reason == PaintInvalidationStyleChange ||
- reason == PaintInvalidationForcedByLayout);
-
- m_collapsedBordersInfo = nullptr;
+void LayoutTable::invalidateCollapsedBorders() {
+ m_collapsedBorders.clear();
if (!collapseBorders())
return;
m_collapsedBordersValid = false;
- if (reason == PaintInvalidationForcedByLayout)
- setShouldDoFullPaintInvalidation(reason);
- else
- setMayNeedPaintInvalidation();
+ setMayNeedPaintInvalidation();
}
// Collect all the unique border values that we want to paint in a sorted list.
@@ -772,15 +765,10 @@
// cache of its containing section, and invalidates itself if any border
// changes. This method doesn't affect layout.
void LayoutTable::recalcCollapsedBordersIfNeeded() {
- if (m_collapsedBordersValid)
+ if (m_collapsedBordersValid || !collapseBorders())
return;
m_collapsedBordersValid = true;
- m_collapsedBordersInfo = nullptr;
- if (!collapseBorders())
- return;
-
- LayoutRect boundsOfChangedCells;
- Vector<CollapsedBorderValue> values;
+ m_collapsedBorders.clear();
for (LayoutObject* section = firstChild(); section;
section = section->nextSibling()) {
if (!section->isTableSection())
@@ -789,23 +777,12 @@
row = row->nextRow()) {
for (LayoutTableCell* cell = row->firstCell(); cell;
cell = cell->nextCell()) {
- DCHECK(cell->table() == this);
- bool cellChanged = cell->collectBorderValues(values);
- if (cellChanged && !shouldDoFullPaintInvalidation()) {
- LayoutRect cellRect = cell->localVisualRect();
- cell->mapToVisualRectInAncestorSpace(this, cellRect);
- boundsOfChangedCells.unite(cellRect);
- }
+ ASSERT(cell->table() == this);
+ cell->collectBorderValues(m_collapsedBorders);
}
}
}
- if (!values.isEmpty()) {
- LayoutTableCell::sortBorderValues(values);
- m_collapsedBordersInfo =
- wrapUnique(new CollapsedBordersInfo(std::move(values)));
- }
-
- invalidatePaintRectangle(boundsOfChangedCells);
+ LayoutTableCell::sortBorderValues(m_collapsedBorders);
}
void LayoutTable::addOverflowFromChildren() {
@@ -1685,10 +1662,10 @@
PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(
const PaintInvalidationState& paintInvalidationState) {
- if (hasCollapsedBorders()) {
+ if (collapseBorders() && !m_collapsedBorders.isEmpty())
paintInvalidationState.paintingLayer()
.setNeedsPaintPhaseDescendantBlockBackgrounds();
- }
+
return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698