Index: Source/core/rendering/compositing/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/compositing/RenderLayerCompositor.cpp b/Source/core/rendering/compositing/RenderLayerCompositor.cpp |
index 84c6c6c6203ac9acfd3c6a6364b398390d66431d..15611da21f7421beb4204105677b1b256e97deb9 100644 |
--- a/Source/core/rendering/compositing/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/compositing/RenderLayerCompositor.cpp |
@@ -606,7 +606,7 @@ bool RenderLayerCompositor::updateSquashingAssignment(RenderLayer* layer, Squash |
LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layer->computeOffsetFromTransformedAncestor(); |
// Compute the offset of this layer from the squashing owner. This computation is correct only because layers are allowed to squash only if they |
- // share a transformed ancestor (see canSquashIntoCurrentSquashingOwner). |
+ // share a transformed ancestor (see computeSquashingBehaviorWhenSquashingRequired). |
LayoutSize offsetFromSquashingCLM(offsetFromTransformedAncestorForSquashedLayer.x() - squashingState.offsetFromTransformedAncestorForSquashingCLM.x(), |
offsetFromTransformedAncestorForSquashedLayer.y() - squashingState.offsetFromTransformedAncestorForSquashingCLM.y()); |
@@ -676,7 +676,7 @@ bool RenderLayerCompositor::squashingWouldExceedSparsityTolerance(const RenderLa |
return newBoundingRectArea > gSquashingSparsityTolerance * newSquashedArea; |
} |
-bool RenderLayerCompositor::canSquashIntoCurrentSquashingOwner(const RenderLayer* layer, const RenderLayerCompositor::SquashingState& squashingState) |
+RenderLayerCompositor::NeedsSquashingBehavior RenderLayerCompositor::computeSquashingBehaviorWhenSquashingRequired(const RenderLayer* layer, const RenderLayerCompositor::SquashingState& squashingState) |
{ |
// FIXME: this special case for video exists only to deal with corner cases |
// where a RenderVideo does not report that it needs to be directly composited. |
@@ -687,38 +687,44 @@ bool RenderLayerCompositor::canSquashIntoCurrentSquashingOwner(const RenderLayer |
// compositing/video/video-controls-layer-creation.html |
// virtual/softwarecompositing/video/video-controls-layer-creation.html |
if (layer->renderer()->isVideo()) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
if (squashingWouldExceedSparsityTolerance(layer, squashingState)) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
// FIXME: this is not efficient, since it walks up the tree . We should store these values on the AncestorDependentPropertiesCache. |
ASSERT(squashingState.hasMostRecentMapping); |
const RenderLayer& squashingLayer = squashingState.mostRecentMapping->owningLayer(); |
- if (layer->renderer()->clippingContainer() != squashingLayer.renderer()->clippingContainer()) |
- return false; |
- |
// Composited descendants need to be clipped by a child contianment graphics layer, which would not be available if the layer is squashed. |
if (clipsCompositingDescendants(layer)) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
if (layer->scrollsWithRespectTo(&squashingLayer)) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
const RenderLayer::AncestorDependentProperties& ancestorDependentProperties = layer->ancestorDependentProperties(); |
const RenderLayer::AncestorDependentProperties& squashingLayerAncestorDependentProperties = squashingLayer.ancestorDependentProperties(); |
if (ancestorDependentProperties.opacityAncestor != squashingLayerAncestorDependentProperties.opacityAncestor) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
if (ancestorDependentProperties.transformAncestor != squashingLayerAncestorDependentProperties.transformAncestor) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
if (ancestorDependentProperties.filterAncestor != squashingLayerAncestorDependentProperties.filterAncestor) |
- return false; |
+ return ShouldPaintIntoOwnLayer; |
+ |
+ if (layer->renderer()->clippingContainer() != squashingLayer.renderer()->clippingContainer()) { |
+ //layer->renderer()->showRenderObject(); |
+ const RenderLayer* parent = layer->renderer()->clippingContainer()->enclosingLayer()->containingGroupedLayer(); |
+ if (parent && squashingLayer.compositedLayerMapping().equals(parent->groupedMapping())) |
+ return ShouldPaintIntoSameLayer; |
+ printf("clipping: ShouldPaintIntoOwnLayer\n"); |
+ return ShouldPaintIntoOwnLayer; |
+ } |
- return true; |
+ return ShouldSquash; |
} |
RenderLayerCompositor::CompositingStateTransitionType RenderLayerCompositor::computeCompositedLayerUpdate(RenderLayer* layer) |
@@ -831,6 +837,7 @@ void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co |
void RenderLayerCompositor::assignLayersToBackings(RenderLayer* updateRoot, bool& layersChanged) |
{ |
SquashingState squashingState; |
+ printf("RenderLayerCompositor::assignLayersToBackings()\n"); |
assignLayersToBackingsInternal(updateRoot, squashingState, layersChanged); |
if (squashingState.hasMostRecentMapping) |
squashingState.mostRecentMapping->finishAccumulatingSquashingLayers(squashingState.nextSquashedLayerIndex); |
@@ -850,8 +857,20 @@ void RenderLayerCompositor::assignLayersToBackingsForReflectionLayer(RenderLayer |
void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, SquashingState& squashingState, bool& layersChanged) |
{ |
- if (layerSquashingEnabled() && requiresSquashing(layer->compositingReasons()) && !canSquashIntoCurrentSquashingOwner(layer, squashingState)) |
- layer->setCompositingReasons(layer->compositingReasons() | CompositingReasonNoSquashingTargetFound); |
+ if (layerSquashingEnabled() && requiresSquashing(layer->compositingReasons())) { |
+ switch (computeSquashingBehaviorWhenSquashingRequired(layer, squashingState)) { |
+ case ShouldPaintIntoOwnLayer: { |
+ printf("assignLayersToBackingsInternal: ShouldPaintIntoOwnLayer\n"); |
+ layer->setCompositingReasons(layer->compositingReasons() | CompositingReasonNoSquashingTargetFound); |
+ break; |
+ } |
+ case ShouldSquash: |
+ break; |
+ case ShouldPaintIntoSameLayer: |
+ layer->setCompositingReasons(CompositingReasonNone); |
+ break; |
+ } |
+ } |
CompositingStateTransitionType compositedLayerUpdate = computeCompositedLayerUpdate(layer); |