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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1441973003: Use recomputed interest rect only if it changed enough (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release builds Created 5 years, 1 month 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/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index b8440dc009530511a66b0bc3962c79e57523656f..d61ec02d198ed490b539551d63177555d9def36d 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -2191,7 +2191,7 @@ static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context,
// cc::DisplayListRecordingSource::UpdateAndExpandInvalidation() before we keep only one copy of the algorithm.
static const int kPixelDistanceToRecord = 4000;
-IntRect CompositedLayerMapping::computeInterestRect(const GraphicsLayer* graphicsLayer, LayoutObject* owningLayoutObject)
+IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graphicsLayer, LayoutObject* owningLayoutObject)
{
FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size());
@@ -2256,33 +2256,23 @@ bool CompositedLayerMapping::interestRectChangedEnoughToRepaint(const IntRect& p
return false;
}
-void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect* interestRect) const
+IntRect CompositedLayerMapping::computeInterestRect(const GraphicsLayer* graphicsLayer, const IntRect& previousInterestRect) const
{
- IntRect defaultInterestRect;
- if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) {
- if (!interestRect) {
- if (graphicsLayer == m_graphicsLayer || graphicsLayer == m_squashingLayer)
- defaultInterestRect = computeInterestRect(graphicsLayer, m_owningLayer.layoutObject());
- else
- defaultInterestRect = enclosingIntRect(FloatRect(FloatPoint(), graphicsLayer->size()));
- interestRect = &defaultInterestRect;
- }
-
- if (!m_owningLayer.needsRepaint()
- && !context.paintController().cacheIsEmpty()
- && !interestRectChangedEnoughToRepaint(m_previousPaintInterestRect, *interestRect, expandedIntSize(graphicsLayer->size()))) {
- context.paintController().createAndAppend<CachedDisplayItem>(*this, DisplayItem::CachedDisplayItemList);
- return;
- }
+ if (graphicsLayer != m_graphicsLayer && graphicsLayer != m_squashingLayer)
+ return IntRect(IntPoint(), expandedIntSize(graphicsLayer->size()));
- m_previousPaintInterestRect = *interestRect;
- }
+ IntRect newInterestRect = recomputeInterestRect(graphicsLayer, m_owningLayer.layoutObject());
+ if (interestRectChangedEnoughToRepaint(previousInterestRect, newInterestRect, expandedIntSize(graphicsLayer->size())))
+ return newInterestRect;
+ return previousInterestRect;
+}
- ASSERT(interestRect);
- paintContentsInternal(graphicsLayer, context, graphicsLayerPaintingPhase, *interestRect);
+bool CompositedLayerMapping::needsRepaint() const
+{
+ return m_owningLayer.needsRepaint();
}
-void CompositedLayerMapping::paintContentsInternal(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& interestRect) const
+void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& interestRect) const
{
// https://code.google.com/p/chromium/issues/detail?id=343772
DisableCompositingQueryAsserts disabler;
@@ -2481,7 +2471,7 @@ void CompositedLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquash
}
}
-String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
+String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer) const
{
String name;
if (graphicsLayer == m_graphicsLayer.get()) {

Powered by Google App Engine
This is Rietveld 408576698