Index: Source/WebCore/rendering/RenderLayerCompositor.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderLayerCompositor.cpp (revision 98520) |
+++ Source/WebCore/rendering/RenderLayerCompositor.cpp (working copy) |
@@ -95,6 +95,7 @@ |
, m_updateCompositingLayersTimer(this, &RenderLayerCompositor::updateCompositingLayersTimerFired) |
, m_hasAcceleratedCompositing(true) |
, m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(ChromeClient::AllTriggers)) |
+ , m_compositedLayerCount(0) |
, m_showDebugBorders(false) |
, m_showRepaintCounter(false) |
, m_compositingConsultsOverlap(true) |
@@ -241,6 +242,11 @@ |
updateCompositingLayers(); |
} |
+bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const |
+{ |
+ return m_compositedLayerCount > rootLayer->isComposited(); |
+} |
+ |
void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot) |
{ |
m_updateCompositingLayersTimer.stop(); |
@@ -305,7 +311,9 @@ |
// Host the document layer in the RenderView's root layer. |
if (updateRoot == rootRenderLayer()) { |
- if (childList.isEmpty()) |
+ // Even when childList is empty, don't drop out of compositing mode if there are |
+ // composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden). |
+ if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(updateRoot)) |
destroyRootLayer(); |
else |
m_rootContentLayer->setChildren(childList); |
@@ -770,8 +778,9 @@ |
} |
// If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need |
- // to be composited, then we can drop out of compositing mode altogether. |
- if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode) { |
+ // to be composited, then we can drop out of compositing mode altogether. However, don't drop out of compositing mode |
+ // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden). |
+ if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) { |
enableCompositingMode(false); |
willBeComposited = false; |
} |