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

Unified Diff: third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp

Issue 2469903002: Use appropriate background object visual rect for composited table cell backgrounds. (Closed)
Patch Set: Explicitly create special clients if needed in TablePaintInvalidator. Add initally-empty test varia… 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/paint/TablePaintInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp
index ae42aec7653bb485b37f094488470f9829c2f779..d6c6df4d4954fcd76652bd3f0e02685ebb4bfad1 100644
--- a/third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp
+++ b/third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp
@@ -23,6 +23,19 @@ PaintInvalidationReason TablePaintInvalidator::invalidatePaintIfNeeded() {
// invalidate all affected cells. Here use shouldDoFullPaintInvalidation() as
// a broader condition of background change.
+ // Note there are explicit calls to
wkorman 2016/11/15 01:05:33 This documents the explicit calls to create the cl
+ // LayoutTableCell::createCompositedCellDisplayItemClients() for all
+ // composited table cell cases below so as to only lazily create the special
+ // display item clients. Composited table cells are an uncommon case. The
+ // logic below handles the case where a cell's row, column, column group, or
+ // section style changes and it moves to a new state where it does not require
+ // these clients.
+ //
+ // We could move the lazy client creation to the specific accessor methods in
+ // LayoutTableCell, but those are const, TableCellPainter's LayoutTableCell is
+ // also const, and TableCellPainter uses those same client accessor methods,
+ // which would fail const-ness.
Xianzhu 2016/11/15 02:58:23 We can use mutable keyword or the LayoutObject::ge
+
// If any col changed background, we'll check all cells for background
// changes.
bool hasColChangedBackground = false;
@@ -58,27 +71,57 @@ PaintInvalidationReason TablePaintInvalidator::invalidatePaintIfNeeded() {
sectionInvalidator
.slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(
*cell, PaintInvalidationStyleChange);
+ if (cell->usesCompositedCellDisplayItemClients()) {
+ cell->createCompositedCellDisplayItemClients();
+ sectionInvalidator.invalidateDisplayItemClient(
+ *cell->sectionBackgroundDisplayItemClient(),
+ PaintInvalidationStyleChange);
+ }
invalidated = true;
} else if (hasColChangedBackground) {
LayoutTable::ColAndColGroup colAndColGroup =
m_table.colElementAtAbsoluteColumn(cell->absoluteColumnIndex());
LayoutTableCol* column = colAndColGroup.col;
LayoutTableCol* columnGroup = colAndColGroup.colgroup;
- if ((columnGroup &&
- columnGroup->backgroundChangedSinceLastPaintInvalidation()) ||
- (column &&
- column->backgroundChangedSinceLastPaintInvalidation())) {
+ bool colGroupBackgroundChanged =
+ columnGroup &&
+ columnGroup->backgroundChangedSinceLastPaintInvalidation();
+ bool colBackgroundChanged =
+ column && column->backgroundChangedSinceLastPaintInvalidation();
+ if (colGroupBackgroundChanged || colBackgroundChanged) {
sectionInvalidator
.slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(
*cell, PaintInvalidationStyleChange);
+ if (colBackgroundChanged &&
+ cell->usesCompositedCellDisplayItemClients()) {
+ cell->createCompositedCellDisplayItemClients();
+ sectionInvalidator.invalidateDisplayItemClient(
+ *cell->colBackgroundDisplayItemClient(),
+ PaintInvalidationStyleChange);
+ }
+ if (colGroupBackgroundChanged &&
+ cell->usesCompositedCellDisplayItemClients()) {
+ cell->createCompositedCellDisplayItemClients();
+ sectionInvalidator.invalidateDisplayItemClient(
+ *cell->colGroupBackgroundDisplayItemClient(),
+ PaintInvalidationStyleChange);
+ }
invalidated = true;
}
}
if ((!invalidated || row->hasSelfPaintingLayer()) &&
- row->backgroundChangedSinceLastPaintInvalidation())
- ObjectPaintInvalidator(*row)
+ row->backgroundChangedSinceLastPaintInvalidation()) {
+ ObjectPaintInvalidator invalidator = ObjectPaintInvalidator(*row);
+ invalidator
.slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(
*cell, PaintInvalidationStyleChange);
+ if (cell->usesCompositedCellDisplayItemClients()) {
+ cell->createCompositedCellDisplayItemClients();
+ invalidator.invalidateDisplayItemClient(
+ *cell->rowBackgroundDisplayItemClient(),
+ PaintInvalidationStyleChange);
+ }
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698