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

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

Issue 2851553002: Invalidate row/section for backgrounds when cell's geometry changes (Closed)
Patch Set: Fix non-spinvalidation Created 3 years, 8 months 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d8daf48d2deecf8b798c087804150a6b4f5c84b7
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.cpp
@@ -0,0 +1,61 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/paint/TableCellPaintInvalidator.h"
+
+#include "core/layout/LayoutTable.h"
+#include "core/layout/LayoutTableCell.h"
+#include "core/layout/LayoutTableCol.h"
+#include "core/layout/LayoutTableRow.h"
+#include "core/layout/LayoutTableSection.h"
+#include "core/paint/BlockPaintInvalidator.h"
+#include "core/paint/ObjectPaintInvalidator.h"
+#include "core/paint/PaintInvalidator.h"
+#include "core/paint/PaintLayer.h"
+
+namespace blink {
+
+PaintInvalidationReason TableCellPaintInvalidator::InvalidatePaint() {
+ // The cell's containing row and section paint backgrounds behind the cell.
+ // If the cell's geometry changed, invalidate the background display items.
+ if (context_.old_location != context_.new_location ||
+ cell_.Size() != cell_.PreviousSize()) {
+ const auto& row = *cell_.Row();
+ if (row.GetPaintInvalidationReason() == kPaintInvalidationNone &&
+ row.StyleRef().HasBackground()) {
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
+ context_.parent_context->painting_layer->SetNeedsRepaint();
+ else
+ ObjectPaintInvalidator(row).SlowSetPaintingLayerNeedsRepaint();
+ row.InvalidateDisplayItemClients(kPaintInvalidationForcedByLayout);
+ }
+
+ const auto& section = *row.Section();
+ if (section.GetPaintInvalidationReason() == kPaintInvalidationNone) {
+ bool section_paints_background = section.StyleRef().HasBackground();
+ if (!section_paints_background) {
+ auto col_and_colgroup = section.Table()->ColElementAtAbsoluteColumn(
+ cell_.AbsoluteColumnIndex());
+ if ((col_and_colgroup.col &&
+ col_and_colgroup.col->StyleRef().HasBackground()) ||
+ (col_and_colgroup.colgroup &&
+ col_and_colgroup.colgroup->StyleRef().HasBackground()))
+ section_paints_background = true;
+ }
+ if (section_paints_background) {
+ if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) {
+ context_.parent_context->parent_context->painting_layer
+ ->SetNeedsRepaint();
+ } else {
+ ObjectPaintInvalidator(section).SlowSetPaintingLayerNeedsRepaint();
+ }
+ section.InvalidateDisplayItemClients(kPaintInvalidationForcedByLayout);
+ }
+ }
+ }
+
+ return BlockPaintInvalidator(cell_).InvalidatePaint(context_);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPaintInvalidator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698