| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // since that requires walking the render layer tree. | 104 // since that requires walking the render layer tree. |
| 105 update = PutInSquashingLayer; | 105 update = PutInSquashingLayer; |
| 106 } else if (layer->groupedMapping() || layer->lostGroupedMapping()) { | 106 } else if (layer->groupedMapping() || layer->lostGroupedMapping()) { |
| 107 update = RemoveFromSquashingLayer; | 107 update = RemoveFromSquashingLayer; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 return update; | 111 return update; |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner(const RenderLa
yer* layer, const CompositingLayerAssigner::SquashingState& squashingState) | 114 CompositingReasons CompositingLayerAssigner::getReasonsPreventingSquashing(const
RenderLayer* layer, const CompositingLayerAssigner::SquashingState& squashingSt
ate) |
| 115 { | 115 { |
| 116 if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) | 116 if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) |
| 117 return false; | 117 return CompositingReasonSquashingWouldBreakPaintOrder; |
| 118 | 118 |
| 119 // FIXME: this special case for video exists only to deal with corner cases | 119 // FIXME: this special case for video exists only to deal with corner cases |
| 120 // where a RenderVideo does not report that it needs to be directly composit
ed. | 120 // where a RenderVideo does not report that it needs to be directly composit
ed. |
| 121 // Video does not currently support sharing a backing, but this could be | 121 // Video does not currently support sharing a backing, but this could be |
| 122 // generalized in the future. The following layout tests fail if we permit t
he | 122 // generalized in the future. The following layout tests fail if we permit t
he |
| 123 // video to share a backing with other layers. | 123 // video to share a backing with other layers. |
| 124 // | 124 // |
| 125 // compositing/video/video-controls-layer-creation.html | 125 // compositing/video/video-controls-layer-creation.html |
| 126 // virtual/softwarecompositing/video/video-controls-layer-creation.html | 126 // virtual/softwarecompositing/video/video-controls-layer-creation.html |
| 127 if (layer->renderer()->isVideo()) | 127 if (layer->renderer()->isVideo()) |
| 128 return false; | 128 return CompositingReasonSquashingVideoIsDisallowed; |
| 129 | 129 |
| 130 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) | 130 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) |
| 131 return false; | 131 return CompositingReasonSquashingSparsityExceeded; |
| 132 | 132 |
| 133 // FIXME: this is not efficient, since it walks up the tree . We should stor
e these values on the CompositingInputsCache. | 133 // FIXME: this is not efficient, since it walks up the tree . We should stor
e these values on the CompositingInputsCache. |
| 134 ASSERT(squashingState.hasMostRecentMapping); | 134 ASSERT(squashingState.hasMostRecentMapping); |
| 135 const RenderLayer& squashingLayer = squashingState.mostRecentMapping->owning
Layer(); | 135 const RenderLayer& squashingLayer = squashingState.mostRecentMapping->owning
Layer(); |
| 136 | 136 |
| 137 if (layer->renderer()->clippingContainer() != squashingLayer.renderer()->cli
ppingContainer()) { | 137 if (layer->renderer()->clippingContainer() != squashingLayer.renderer()->cli
ppingContainer()) { |
| 138 if (!squashingLayer.compositedLayerMapping()->containingSquashedLayer(la
yer->renderer()->clippingContainer())) | 138 if (!squashingLayer.compositedLayerMapping()->containingSquashedLayer(la
yer->renderer()->clippingContainer())) |
| 139 return false; | 139 return CompositingReasonSquashingClippingContainerMismatch; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Composited descendants need to be clipped by a child contianment graphics
layer, which would not be available if the layer is | 142 // Composited descendants need to be clipped by a child containment graphics
layer, which would not be available if the layer is |
| 143 // squashed (and therefore has no CLM nor a child containment graphics layer
). |
| 143 if (m_compositor->clipsCompositingDescendants(layer)) | 144 if (m_compositor->clipsCompositingDescendants(layer)) |
| 144 return false; | 145 return CompositingReasonSquashedLayerClipsCompositingDescendants; |
| 145 | 146 |
| 146 if (layer->scrollsWithRespectTo(&squashingLayer)) | 147 if (layer->scrollsWithRespectTo(&squashingLayer)) |
| 147 return false; | 148 return CompositingReasonScrollsWithRespectToSquashingLayer; |
| 148 | 149 |
| 149 const RenderLayer::CompositingInputs& compositingInputs = layer->compositing
Inputs(); | 150 const RenderLayer::CompositingInputs& compositingInputs = layer->compositing
Inputs(); |
| 150 const RenderLayer::CompositingInputs& squashingLayerCompositingInputs = squa
shingLayer.compositingInputs(); | 151 const RenderLayer::CompositingInputs& squashingLayerCompositingInputs = squa
shingLayer.compositingInputs(); |
| 151 | 152 |
| 152 if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opa
cityAncestor) | 153 if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opa
cityAncestor) |
| 153 return false; | 154 return CompositingReasonSquashingOpacityAncestorMismatch; |
| 154 | 155 |
| 155 if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.t
ransformAncestor) | 156 if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.t
ransformAncestor) |
| 156 return false; | 157 return CompositingReasonSquashingTransformAncestorMismatch; |
| 157 | 158 |
| 158 if (compositingInputs.filterAncestor != squashingLayerCompositingInputs.filt
erAncestor) | 159 if (compositingInputs.filterAncestor != squashingLayerCompositingInputs.filt
erAncestor) |
| 159 return false; | 160 return CompositingReasonSquashingFilterAncestorMismatch; |
| 160 | 161 |
| 161 return true; | 162 return CompositingReasonNone; |
| 162 } | 163 } |
| 163 | 164 |
| 164 bool CompositingLayerAssigner::updateSquashingAssignment(RenderLayer* layer, Squ
ashingState& squashingState, const CompositingStateTransitionType compositedLaye
rUpdate, | 165 bool CompositingLayerAssigner::updateSquashingAssignment(RenderLayer* layer, Squ
ashingState& squashingState, const CompositingStateTransitionType compositedLaye
rUpdate, |
| 165 Vector<RenderLayer*>& layersNeedingRepaint) | 166 Vector<RenderLayer*>& layersNeedingRepaint) |
| 166 { | 167 { |
| 167 // NOTE: In the future as we generalize this, the background of this layer m
ay need to be assigned to a different backing than | 168 // NOTE: In the future as we generalize this, the background of this layer m
ay need to be assigned to a different backing than |
| 168 // the squashed RenderLayer's own primary contents. This would happen when w
e have a composited negative z-index element that needs | 169 // the squashed RenderLayer's own primary contents. This would happen when w
e have a composited negative z-index element that needs |
| 169 // to paint on top of the background, but below the layer's main contents. F
or now, because we always composite layers | 170 // to paint on top of the background, but below the layer's main contents. F
or now, because we always composite layers |
| 170 // when they have a composited negative z-index child, such layers will neve
r need squashing so it is not yet an issue. | 171 // when they have a composited negative z-index child, such layers will neve
r need squashing so it is not yet an issue. |
| 171 if (compositedLayerUpdate == PutInSquashingLayer) { | 172 if (compositedLayerUpdate == PutInSquashingLayer) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 layersChanged = true; | 216 layersChanged = true; |
| 216 m_compositor->allocateOrClearCompositedLayerMapping(reflectionLayer, com
positedLayerUpdate); | 217 m_compositor->allocateOrClearCompositedLayerMapping(reflectionLayer, com
positedLayerUpdate); |
| 217 } | 218 } |
| 218 m_compositor->updateDirectCompositingReasons(reflectionLayer); | 219 m_compositor->updateDirectCompositingReasons(reflectionLayer); |
| 219 if (reflectionLayer->hasCompositedLayerMapping()) | 220 if (reflectionLayer->hasCompositedLayerMapping()) |
| 220 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat
ion(GraphicsLayerUpdater::ForceUpdate); | 221 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat
ion(GraphicsLayerUpdater::ForceUpdate); |
| 221 } | 222 } |
| 222 | 223 |
| 223 void CompositingLayerAssigner::assignLayersToBackingsInternal(RenderLayer* layer
, SquashingState& squashingState, bool& layersChanged, Vector<RenderLayer*>& lay
ersNeedingRepaint) | 224 void CompositingLayerAssigner::assignLayersToBackingsInternal(RenderLayer* layer
, SquashingState& squashingState, bool& layersChanged, Vector<RenderLayer*>& lay
ersNeedingRepaint) |
| 224 { | 225 { |
| 225 if (m_layerSquashingEnabled && requiresSquashing(layer->compositingReasons()
) && !canSquashIntoCurrentSquashingOwner(layer, squashingState)) | 226 if (m_layerSquashingEnabled && requiresSquashing(layer->compositingReasons()
)) { |
| 226 layer->setCompositingReasons(layer->compositingReasons() | CompositingRe
asonNoSquashingTargetFound); | 227 CompositingReasons reasonsPreventingSquashing = getReasonsPreventingSqua
shing(layer, squashingState); |
| 228 if (reasonsPreventingSquashing) |
| 229 layer->setCompositingReasons(layer->compositingReasons() | reasonsPr
eventingSquashing); |
| 230 } |
| 227 | 231 |
| 228 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye
rUpdate(layer); | 232 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye
rUpdate(layer); |
| 229 | 233 |
| 230 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay
erUpdate)) { | 234 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay
erUpdate)) { |
| 231 layersNeedingRepaint.append(layer); | 235 layersNeedingRepaint.append(layer); |
| 232 layersChanged = true; | 236 layersChanged = true; |
| 233 } | 237 } |
| 234 | 238 |
| 235 // FIXME: special-casing reflection layers here is not right. | 239 // FIXME: special-casing reflection layers here is not right. |
| 236 if (layer->reflectionInfo()) | 240 if (layer->reflectionInfo()) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 266 | 270 |
| 267 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); | 271 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); |
| 268 while (RenderLayerStackingNode* curNode = iterator.next()) | 272 while (RenderLayerStackingNode* curNode = iterator.next()) |
| 269 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC
hanged, layersNeedingRepaint); | 273 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC
hanged, layersNeedingRepaint); |
| 270 | 274 |
| 271 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping
->owningLayer() == layer) | 275 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping
->owningLayer() == layer) |
| 272 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; | 276 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; |
| 273 } | 277 } |
| 274 | 278 |
| 275 } | 279 } |
| OLD | NEW |