summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-01-25 12:47:59 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-25 12:47:59 -0800
commitce7f402c69fcd625a91611f47cd61d1baa3681b9 (patch)
tree084a837b61cf12f1717655410cda1578482c75bf /Source/WebCore
parent56c83b8f60acdfe77deff2cfc5977fb3ed09f6f2 (diff)
parenta7037f19fed3a0edccf720bb8c78a6fb73492510 (diff)
downloadexternal_webkit-ce7f402c69fcd625a91611f47cd61d1baa3681b9.zip
external_webkit-ce7f402c69fcd625a91611f47cd61d1baa3681b9.tar.gz
external_webkit-ce7f402c69fcd625a91611f47cd61d1baa3681b9.tar.bz2
Merge "Reduce the number of the composited layers."
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/rendering/RenderLayerCompositor.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 33bf2f7..03f1e41 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -92,6 +92,10 @@ struct CompositingState {
RenderLayer* m_compositingAncestor;
bool m_subtreeIsCompositing;
+ // m_compositingBounds is only used in computeCompositingRequirements. It can be either the
+ // ancestor bounds or the bounds for the sibling layers which are above the composited layer.
+ // It is used to reject creating unnecesary layers.
+ IntRect m_compositingBounds;
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
bool m_fixedSibling;
bool m_hasFixedElement;
@@ -693,7 +697,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (absBounds.isEmpty())
absBounds.setSize(IntSize(1, 1));
haveComputedBounds = true;
- mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds);
+ // If the current subtree is not compositing, and the layer is fully inside the current compositing bounnds,
+ // there is no need to do the overlap test. This reduces the total number of the composited layers.
+ if (compositingState.m_subtreeIsCompositing || !compositingState.m_compositingBounds.contains(absBounds))
+ mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds);
}
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
@@ -709,6 +716,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
// a compositing layer among them, so start by inheriting the compositing
// ancestor with m_subtreeIsCompositing set to false.
CompositingState childState(compositingState.m_compositingAncestor);
+ if (compositingState.m_subtreeIsCompositing)
+ childState.m_compositingBounds = absBounds;
+ else
+ childState.m_compositingBounds = compositingState.m_compositingBounds;
#ifndef NDEBUG
++childState.m_depth;
#endif
@@ -729,6 +740,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
compositingState.m_subtreeIsCompositing = true;
// This layer now acts as the ancestor for kids.
childState.m_compositingAncestor = layer;
+ childState.m_compositingBounds = absBounds;
if (overlapMap)
addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
}