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

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

Issue 2430313004: Paint collapsed borders of a table as one display item (Closed)
Patch Set: Rebaseline on mac and win Created 4 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: 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 6f0b62e686cc00807ab2b155b451a7adfd20c415..44373b79816e41bf3cd2ce0928b86c0e837f4eb0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -752,7 +752,7 @@ void LayoutTable::layout() {
}
void LayoutTable::invalidateCollapsedBorders() {
- m_collapsedBorders.clear();
+ m_collapsedBordersInfo = nullptr;
if (!collapseBorders())
return;
@@ -765,10 +765,15 @@ 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;
+
+ LayoutRect boundsOfChangedCells;
+ Vector<CollapsedBorderValue> values;
for (LayoutObject* section = firstChild(); section;
section = section->nextSibling()) {
if (!section->isTableSection())
@@ -777,12 +782,23 @@ void LayoutTable::recalcCollapsedBordersIfNeeded() {
row = row->nextRow()) {
for (LayoutTableCell* cell = row->firstCell(); cell;
cell = cell->nextCell()) {
- ASSERT(cell->table() == this);
- cell->collectBorderValues(m_collapsedBorders);
+ DCHECK(cell->table() == this);
+ if (cell->collectBorderValues(values) &&
+ !shouldDoFullPaintInvalidation()) {
+ LayoutRect cellRect = cell->localVisualRect();
+ cell->mapToVisualRectInAncestorSpace(this, cellRect);
+ boundsOfChangedCells.unite(cellRect);
+ }
}
}
}
- LayoutTableCell::sortBorderValues(m_collapsedBorders);
+ if (!values.isEmpty()) {
+ LayoutTableCell::sortBorderValues(values);
+ m_collapsedBordersInfo =
+ wrapUnique(new CollapsedBordersInfo(std::move(values)));
+ }
+
+ invalidatePaintRectangle(boundsOfChangedCells);
}
void LayoutTable::addOverflowFromChildren() {
@@ -1662,10 +1678,10 @@ void LayoutTable::ensureIsReadyForPaintInvalidation() {
PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(
const PaintInvalidationState& paintInvalidationState) {
- if (collapseBorders() && !m_collapsedBorders.isEmpty())
+ if (hasCollapsedBorders()) {
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