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

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 eedca8d87b2e4e5ed0df5364011f1a75c4de5a89..0dfc5589a62a1a6e8c936c0d8f78ea2e6771f05f 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
@@ -455,15 +455,37 @@ 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);
+}
+
+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 (m_object.parent() && m_context.parentContext &&
+ m_context.parentContext->paintInvalidationContainer ==
+ m_context.paintInvalidationContainer &&
+ // This is a quick test to exclude the case that parent and child are not
+ // on the same backing of the paint invalidation container.
+ m_object.parent() != m_context.paintInvalidationContainer &&
wkorman 2017/02/23 01:26:25 I wanted to better understand how checking whether
Xianzhu 2017/02/23 04:38:49 The idea was that the paint invalidation container
+ isImmediateFullPaintInvalidationReason(
+ m_object.parent()->fullPaintInvalidationReason()) &&
+ (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