Index: Source/core/rendering/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
index 81b9398e15a744bdeaeb350cf1ed78c11372fa07..36525dc645871964a34a84387bad5f3f29bfb290 100644 |
--- a/Source/core/rendering/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/RenderLayerCompositor.cpp |
@@ -324,7 +324,7 @@ void RenderLayerCompositor::didChangeVisibleRect() |
bool RenderLayerCompositor::hasAnyAdditionalCompositedLayers(const RenderLayer* rootLayer) const |
{ |
- return m_compositedLayerCount > (rootLayer->isComposited() ? 1 : 0); |
+ return m_compositedLayerCount > (rootLayer->compositedLayerMapping() ? 1 : 0); |
} |
void RenderLayerCompositor::updateCompositingRequirementsState() |
@@ -671,7 +671,7 @@ void RenderLayerCompositor::repaintInCompositedAncestor(RenderLayer* layer, cons |
{ |
RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint(false /*exclude self*/); |
if (compositedAncestor) { |
- ASSERT(compositedAncestor->compositedLayerMapping()); |
+ ASSERT(compositedAncestor->compositingState() == PaintsIntoOwnBacking); |
LayoutPoint offset; |
layer->convertToLayerCoords(compositedAncestor, offset); |
@@ -706,7 +706,7 @@ void RenderLayerCompositor::layerWasAdded(RenderLayer* /*parent*/, RenderLayer* |
void RenderLayerCompositor::layerWillBeRemoved(RenderLayer* parent, RenderLayer* child) |
{ |
- if (!child->isComposited() || parent->renderer()->documentBeingDestroyed()) |
+ if (!child->compositedLayerMapping() || parent->renderer()->documentBeingDestroyed()) |
return; |
removeViewportConstrainedLayer(child); |
@@ -1021,7 +1021,6 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
// Set the flag to say that this SC has compositing children. |
layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing); |
- |
// Turn overlap testing off for later layers if it's already off, or if we have an animating transform. |
// Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because |
// we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map. |
@@ -1045,7 +1044,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
// At this point we have finished collecting all reasons to composite this layer. |
layer->setCompositingReasons(reasonsToComposite); |
- // Allocate or deallocate the compositedLayerMapping now, so that we can use isComposited() reliably during tree traversal in rebuildCompositingLayerTree(). |
+ // Allocate or deallocate the compositedLayerMapping now, so that we can know the layer's compositing state reliably during tree traversal in rebuildCompositingLayerTree(). |
if (allocateOrClearCompositedLayerMapping(layer, CompositingChangeRepaintNow)) |
layersChanged = true; |
@@ -1061,12 +1060,12 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer) |
{ |
ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer); |
- ASSERT(childLayer->isComposited()); |
+ ASSERT(childLayer->compositedLayerMapping()); |
// It's possible to be called with a parent that isn't yet composited when we're doing |
// partial updates as required by painting or hit testing. Just bail in that case; |
// we'll do a full layer update soon. |
- if (!parentLayer || !parentLayer->isComposited()) |
+ if (!parentLayer || !parentLayer->compositedLayerMapping()) |
return; |
if (parentLayer) { |
@@ -1081,7 +1080,7 @@ void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, Render |
void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer) |
{ |
- ASSERT(layer->isComposited()); |
+ ASSERT(layer->compositedLayerMapping()); |
GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSublayers(); |
hostingLayer->removeAllChildren(); |
@@ -1370,7 +1369,7 @@ bool RenderLayerCompositor::parentFrameContentLayers(RenderPart* renderer) |
return false; |
RenderLayer* layer = renderer->layer(); |
- if (!layer->isComposited()) |
+ if (!layer->compositedLayerMapping()) |
return false; |
CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping(); |
@@ -1496,7 +1495,7 @@ void RenderLayerCompositor::repaintCompositedLayers(const IntRect* absRect) |
void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntRect* rect) |
{ |
// FIXME: This method does not work correctly with transforms. |
- if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCompositedAncestor()) { |
+ if (layer->compositingState() == PaintsIntoOwnBacking) { |
if (rect) |
layer->setBackingNeedsRepaintInRect(*rect); |
else |
@@ -1589,7 +1588,7 @@ void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(Rende |
if (!layer) |
return; |
- if (layer->isComposited()) { |
+ if (layer->compositedLayerMapping()) { |
removeViewportConstrainedLayer(layer); |
layer->clearCompositedLayerMapping(); |
} |
@@ -1643,6 +1642,8 @@ bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const |
bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, const RenderLayer* compositingAncestorLayer) const |
{ |
RenderObject* renderer = layer->renderer(); |
+ |
+ // A layer definitely needs its own backing if we cannot paint into the composited ancestor. |
if (compositingAncestorLayer |
&& !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLayer()->drawsContent() |
|| compositingAncestorLayer->compositedLayerMapping()->paintsIntoCompositedAncestor())) |
@@ -1729,7 +1730,7 @@ CompositingReasons RenderLayerCompositor::reasonsForCompositing(const RenderLaye |
{ |
CompositingReasons reasons = CompositingReasonNone; |
- if (!layer || !layer->isComposited()) |
+ if (!layer || !layer->compositedLayerMapping()) |
return reasons; |
return layer->compositingReasons(); |
@@ -1820,7 +1821,7 @@ const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l |
// but a sibling in the z-order hierarchy. |
bool RenderLayerCompositor::clippedByAncestor(const RenderLayer* layer) const |
{ |
- if (!layer->isComposited() || !layer->parent()) |
+ if (!layer->compositedLayerMapping() || !layer->parent()) |
return false; |
const RenderLayer* compositingAncestor = layer->ancestorCompositingLayer(); |
@@ -1929,7 +1930,7 @@ bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer) |
RenderWidget* pluginRenderer = toRenderWidget(renderer); |
// If we can't reliably know the size of the plugin yet, don't change compositing state. |
if (pluginRenderer->needsLayout()) |
- return pluginRenderer->hasLayer() && pluginRenderer->layer()->isComposited(); |
+ return pluginRenderer->hasLayer() && pluginRenderer->layer()->compositedLayerMapping(); |
// Don't go into compositing mode if height or width are zero, or size is 1x1. |
IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |
@@ -1954,7 +1955,7 @@ bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) |
// If we can't reliably know the size of the iframe yet, don't change compositing state. |
if (renderer->needsLayout()) |
- return frameRenderer->hasLayer() && frameRenderer->layer()->isComposited(); |
+ return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLayerMapping(); |
// Don't go into compositing mode if height or width are zero. |
IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); |
@@ -2124,7 +2125,7 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderObject* rendere |
// Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done. |
if (!m_inPostLayoutUpdate) { |
m_reevaluateCompositingAfterLayout = true; |
- return layer->isComposited(); |
+ return layer->compositedLayerMapping(); |
} |
bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescendant(); |
@@ -2235,7 +2236,7 @@ GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const |
if (!viewLayer) |
return 0; |
- if (viewLayer->isComposited() && viewLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) |
+ if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground()) |
return viewLayer->compositedLayerMapping()->backgroundLayer(); |
return 0; |
@@ -2652,7 +2653,7 @@ static bool isRootmostFixedOrStickyLayer(RenderLayer* layer) |
return false; |
for (RenderLayer* stackingContainer = layer->ancestorStackingContainer(); stackingContainer; stackingContainer = stackingContainer->ancestorStackingContainer()) { |
- if (stackingContainer->isComposited() && stackingContainer->renderer()->style()->position() == FixedPosition) |
+ if (stackingContainer->compositedLayerMapping() && stackingContainer->renderer()->style()->position() == FixedPosition) |
return false; |
} |
@@ -2682,7 +2683,7 @@ void RenderLayerCompositor::removeViewportConstrainedLayer(RenderLayer* layer) |
FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportConstraints(RenderLayer* layer) const |
{ |
- ASSERT(layer->isComposited()); |
+ ASSERT(layer->compositedLayerMapping()); |
FrameView* frameView = m_renderView->frameView(); |
LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); |
@@ -2720,7 +2721,7 @@ FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons |
StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportConstraints(RenderLayer* layer) const |
{ |
- ASSERT(layer->isComposited()); |
+ ASSERT(layer->compositedLayerMapping()); |
FrameView* frameView = m_renderView->frameView(); |
LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect(); |