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 6a5ecd5fa8a6457660d2d00fd965bb33f43651ea..14d06592656a59dcd97bb406c3ec862293c79260 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
@@ -752,12 +752,12 @@ void LayoutTable::layout() { |
} |
void LayoutTable::invalidateCollapsedBorders() { |
- m_collapsedBorders.clear(); |
+ m_collapsedBordersInfo = nullptr; |
if (!collapseBorders()) |
return; |
m_collapsedBordersValid = false; |
- setMayNeedPaintInvalidation(); |
+ setShouldDoFullPaintInvalidation(); |
} |
// Collect all the unique border values that we want to paint in a sorted list. |
@@ -765,10 +765,14 @@ void LayoutTable::invalidateCollapsedBorders() { |
// cache of its containing section, and invalidates itself if any border |
// changes. This method doesn't affect layout. |
void LayoutTable::recalcCollapsedBordersIfNeeded() { |
- if (m_collapsedBordersValid || !collapseBorders()) |
+ if (m_collapsedBordersValid) |
return; |
m_collapsedBordersValid = true; |
- m_collapsedBorders.clear(); |
+ m_collapsedBordersInfo = nullptr; |
+ if (!collapseBorders()) |
+ return; |
+ |
+ Vector<CollapsedBorderValue> values; |
for (LayoutObject* section = firstChild(); section; |
section = section->nextSibling()) { |
if (!section->isTableSection()) |
@@ -778,11 +782,15 @@ void LayoutTable::recalcCollapsedBordersIfNeeded() { |
for (LayoutTableCell* cell = row->firstCell(); cell; |
cell = cell->nextCell()) { |
ASSERT(cell->table() == this); |
- cell->collectBorderValues(m_collapsedBorders); |
+ cell->collectBorderValues(values); |
} |
} |
} |
- LayoutTableCell::sortBorderValues(m_collapsedBorders); |
+ if (!values.isEmpty()) { |
+ LayoutTableCell::sortBorderValues(values); |
+ m_collapsedBordersInfo = |
+ wrapUnique(new CollapsedBordersInfo(std::move(values))); |
+ } |
} |
void LayoutTable::addOverflowFromChildren() { |
@@ -1662,10 +1670,10 @@ void LayoutTable::ensureIsReadyForPaintInvalidation() { |
PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded( |
const PaintInvalidationState& paintInvalidationState) { |
- if (collapseBorders() && !m_collapsedBorders.isEmpty()) |
+ if (hasCollapsedBorders()) { |
paintInvalidationState.paintingLayer() |
.setNeedsPaintPhaseDescendantBlockBackgrounds(); |
- |
+ } |
return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
} |