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 |