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

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

Issue 2732573003: Skip paint property update and visual rect update if no geometry change (Closed)
Patch Set: - Created 3 years, 9 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
Index: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
index e786211bc8f7fb43b959dd131c6b0df3d676c34a..ecb5fc71833fa2d14a623a0d43984a5f5a2e9dbb 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -9,6 +9,7 @@
#include "core/layout/LayoutView.h"
#include "core/layout/api/LayoutPartItem.h"
#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/paint/FindPaintOffsetAndVisualRectNeedingUpdate.h"
#include "core/paint/PaintInvalidator.h"
#include "core/paint/PaintLayer.h"
#include "platform/HostWindow.h"
@@ -579,9 +580,9 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
DISABLE_CFI_PERF
void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded(
PaintInvalidationReason reason) {
- // Update selection rect when we are doing full invalidation (in case that the
- // object is moved, composite status changed, etc.) or
- // shouldInvalidationSelection is set (in case that the selection itself
+ // Update selection rect when we are doing full invalidation with geometry
+ // change (in case that the object is moved, composite status changed, etc.)
+ // or shouldInvalidationSelection is set (in case that the selection itself
// changed).
bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason);
if (!fullInvalidation && !m_object.shouldInvalidateSelection())
@@ -592,8 +593,18 @@ void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded(
LayoutRect oldSelectionRect;
if (m_object.hasSelectionVisualRect())
oldSelectionRect = selectionVisualRectMap().at(&m_object);
- LayoutRect newSelectionRect = m_object.localSelectionRect();
- m_context.mapLocalRectToVisualRectInBacking(m_object, newSelectionRect);
+
+ LayoutRect newSelectionRect;
+#if DCHECK_IS_ON()
+ FindVisualRectNeedingUpdateScope finder(m_object, m_context, oldSelectionRect,
+ newSelectionRect);
+#endif
+ if (m_context.needsVisualRectUpdate(m_object)) {
+ newSelectionRect = m_object.localSelectionRect();
+ m_context.mapLocalRectToVisualRectInBacking(m_object, newSelectionRect);
+ } else {
+ newSelectionRect = oldSelectionRect;
+ }
setSelectionVisualRect(m_object, newSelectionRect);
@@ -643,7 +654,8 @@ ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason(
DCHECK(isImmediateFullPaintInvalidationReason(reason));
// This allows descendants to know the computed reason if it's different
// from the original reason before paint invalidation.
- m_object.getMutableForPainting().setShouldDoFullPaintInvalidation(reason);
+ m_object.getMutableForPainting()
+ .setShouldDoFullPaintInvalidationWithoutGeometryChange(reason);
fullyInvalidatePaint(reason, m_context.oldVisualRect,
m_object.visualRect());
}

Powered by Google App Engine
This is Rietveld 408576698