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

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

Issue 2707063003: Don't invalidate rect if it's covered by fully invalidated parent's visual rect (Closed)
Patch Set: - Created 3 years, 10 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 d8d4210e8fbd2189683d0c7654a2b206c7566f44..4e3abb456dfac468f426b3bce8d45a5416cf2827 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -455,15 +455,54 @@ void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint(
// the other.
if (!newVisualRect.contains(oldVisualRect)) {
LayoutRect invalidationRect = oldVisualRect;
- invalidatePaintUsingContainer(*m_context.paintInvalidationContainer,
- invalidationRect, reason);
+ invalidatePaintRectangleWithContext(invalidationRect, reason);
if (invalidationRect.contains(newVisualRect))
return;
}
- invalidatePaintUsingContainer(*m_context.paintInvalidationContainer,
- newVisualRect, reason);
+ invalidatePaintRectangleWithContext(newVisualRect, reason);
+}
+
+bool ObjectPaintInvalidatorWithContext::parentFullyInvalidatedOnSameBacking() {
+ if (!m_object.parent() || !m_context.parentContext)
+ return false;
+
+ if (!isImmediateFullPaintInvalidationReason(
+ m_object.parent()->fullPaintInvalidationReason()))
+ return false;
+
+ // Parent and child should have the same paint invalidation container.
+ if (m_context.parentContext->paintInvalidationContainer !=
+ m_context.paintInvalidationContainer)
+ return false;
+
+ // Both parent and child are contents of the paint invalidation container,
+ // so they are on the same backing.
+ if (m_object.parent() != m_context.paintInvalidationContainer)
+ return true;
+
+ // If the paint invalidation container (i.e. parent) uses composited
+ // scrolling, parent and child might be on different backing (scrolling
+ // container vs scrolling contents).
+ return !m_context.paintInvalidationContainer->usesCompositedScrolling();
+}
+
+void ObjectPaintInvalidatorWithContext::invalidatePaintRectangleWithContext(
+ const LayoutRect& rect,
+ PaintInvalidationReason reason) {
+ if (rect.isEmpty())
+ return;
+
+ // If the parent has fully invalidated and its visual rect covers this object
+ // on the same backing, skip the invalidation.
+ if (parentFullyInvalidatedOnSameBacking() &&
+ (m_context.parentContext->oldVisualRect.contains(rect) ||
+ m_context.parentContext->newVisualRect.contains(rect)))
+ return;
+
+ invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, rect,
+ reason);
}
DISABLE_CFI_PERF
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.h ('k') | third_party/WebKit/Source/core/paint/PaintInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698