Permalink
Browse files

Prevent infinite loop when turning on then off composited mode

bug:5820635
Change-Id: I24b6eae6c76c29e44106b4ec87e74d945aad7b1b
  • Loading branch information...
1 parent b627d5b commit 3c049d2aded213c7bcc49cdb7283cf0fcb509644 Nicolas Roard committed Jan 13, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1366,7 +1366,21 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
return false;
// The root layer always has a compositing layer, but it may not have backing.
+#if PLATFORM(ANDROID)
+ // If we do not have a root platform layer, don't use the
+ // mustOverlapCompositedLayers() as a cue that this layer needs to be
+ // composited -- the layers tree has been detached.
+ // Otherwise we can end up in a cycle where updateBacking() switches composited
+ // mode on because a layer has mustOverlapCompositedLayers() (by calling
+ // enableCompositingMode()), while computeCompositingRequirements() will
+ // (correctly) say that we do not need to be in composited mode and turns it
+ // off, rince and repeat...
+ return requiresCompositingLayer(layer)
+ || (m_rootPlatformLayer && layer->mustOverlapCompositedLayers())
+ || (inCompositingMode() && layer->isRootLayer());
+#else
return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers() || (inCompositingMode() && layer->isRootLayer());
+#endif
}
#if PLATFORM(ANDROID)

0 comments on commit 3c049d2

Please sign in to comment.