Index: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
index 4d51cb8a53798cfdf7b835e5a4b01253204fe94c..6dadd47098015f513919193337e3c42d26a1e977 100644 |
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
@@ -293,9 +293,9 @@ void GraphicsLayer::setOffsetDoubleFromLayoutObject(const DoubleSize& offset, Sh |
setNeedsDisplay(); |
} |
-void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip) |
+void GraphicsLayer::paint(GraphicsContext& context, const IntRect* interestRect) |
{ |
- ASSERT(clip || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
+ ASSERT(interestRect || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()); |
ASSERT(drawsContent()); |
if (!m_client) |
@@ -312,8 +312,22 @@ void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip) |
} |
} |
#endif |
- m_client->paintContents(this, context, m_paintingPhase, clip); |
+ |
+ IntRect newInterestRect; |
+ if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
+ if (!interestRect) { |
+ newInterestRect = m_client->computeInterestRect(this, m_previousInterestRect); |
+ interestRect = &newInterestRect; |
+ } |
+ if (!m_client->needsRepaint() && !paintController()->cacheIsEmpty() && m_previousInterestRect == *interestRect) { |
+ paintController()->createAndAppend<CachedDisplayItem>(*this, DisplayItem::CachedDisplayItemList); |
+ return; |
+ } |
+ } |
+ |
+ m_client->paintContents(this, context, m_paintingPhase, *interestRect); |
notifyFirstPaintToClient(); |
+ m_previousInterestRect = *interestRect; |
} |
void GraphicsLayer::notifyFirstPaintToClient() |