CompositingReasons CompositingLayerAssigner::getReasonsPreventingSquashing(const RenderLayer* layer, const CompositingLayerAssigner::SquashingState& squashingState) { if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) return CompositingReasonSquashingWouldBreakPaintOrder; ASSERT(squashingState.hasMostRecentMapping); const RenderLayer& squashingLayer = squashingState.mostRecentMapping->owningLayer(); // 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. // Video does not currently support sharing a backing, but this could be // generalized in the future. The following layout tests fail if we permit the // video to share a backing with other layers. // // compositing/video/video-controls-layer-creation.html if (layer->renderer()->isVideo() || squashingLayer.renderer()->isVideo()) return CompositingReasonSquashingVideoIsDisallowed; // Don't squash iframes, frames or plugins. // FIXME: this is only necessary because there is frame code that assumes that composited frames are not squashed. if (layer->renderer()->isRenderPart() || squashingLayer.renderer()->isRenderPart()) return CompositingReasonSquashingRenderPartIsDisallowed; if (layer->reflectionInfo()) return CompositingReasonSquashingReflectionIsDisallowed; if (squashingWouldExceedSparsityTolerance(layer, squashingState)) return CompositingReasonSquashingSparsityExceeded; if (layer->renderer()->hasBlendMode()) return CompositingReasonSquashingBlendingIsDisallowed; // FIXME: this is not efficient, since it walks up the tree. We should store these values on the CompositingInputsCache. if (layer->clippingContainer() != squashingLayer.clippingContainer() && !squashingLayer.compositedLayerMapping()->containingSquashedLayer(layer->clippingContainer(), squashingState.nextSquashedLayerIndex)) return CompositingReasonSquashingClippingContainerMismatch; // Composited descendants need to be clipped by a child containment graphics layer, which would not be available if the layer is // squashed (and therefore has no CLM nor a child containment graphics layer). if (m_compositor->clipsCompositingDescendants(layer)) return CompositingReasonSquashedLayerClipsCompositingDescendants; if (layer->scrollsWithRespectTo(&squashingLayer)) return CompositingReasonScrollsWithRespectToSquashingLayer; const RenderLayer::AncestorDependentCompositingInputs& compositingInputs = layer->ancestorDependentCompositingInputs(); const RenderLayer::AncestorDependentCompositingInputs& squashingLayerCompositingInputs = squashingLayer.ancestorDependentCompositingInputs(); if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opacityAncestor) return CompositingReasonSquashingOpacityAncestorMismatch; if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.transformAncestor) return CompositingReasonSquashingTransformAncestorMismatch; if (layer->hasFilter() || compositingInputs.filterAncestor != squashingLayerCompositingInputs.filterAncestor) return CompositingReasonSquashingFilterMismatch; return CompositingReasonNone; }
bool CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner(const RenderLayer* layer, const CompositingLayerAssigner::SquashingState& squashingState) { if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) return false; // 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. // Video does not currently support sharing a backing, but this could be // generalized in the future. The following layout tests fail if we permit the // video to share a backing with other layers. // // compositing/video/video-controls-layer-creation.html // virtual/softwarecompositing/video/video-controls-layer-creation.html if (layer->renderer()->isVideo()) return false; if (squashingWouldExceedSparsityTolerance(layer, squashingState)) return false; // 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()) { if (!squashingLayer.compositedLayerMapping()->containingSquashedLayer(layer->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 if (m_compositor->clipsCompositingDescendants(layer)) return false; if (layer->scrollsWithRespectTo(&squashingLayer)) return false; const RenderLayer::AncestorDependentProperties& ancestorDependentProperties = layer->ancestorDependentProperties(); const RenderLayer::AncestorDependentProperties& squashingLayerAncestorDependentProperties = squashingLayer.ancestorDependentProperties(); if (ancestorDependentProperties.opacityAncestor != squashingLayerAncestorDependentProperties.opacityAncestor) return false; if (ancestorDependentProperties.transformAncestor != squashingLayerAncestorDependentProperties.transformAncestor) return false; if (ancestorDependentProperties.filterAncestor != squashingLayerAncestorDependentProperties.filterAncestor) return false; return true; }