| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ASSERT(squashingState.hasMostRecentMapping); | 121 ASSERT(squashingState.hasMostRecentMapping); |
| 122 const Layer& squashingLayer = squashingState.mostRecentMapping->owningLayer(
); | 122 const Layer& squashingLayer = squashingState.mostRecentMapping->owningLayer(
); |
| 123 | 123 |
| 124 // FIXME: this special case for video exists only to deal with corner cases | 124 // FIXME: this special case for video exists only to deal with corner cases |
| 125 // where a LayoutVideo does not report that it needs to be directly composit
ed. | 125 // where a LayoutVideo does not report that it needs to be directly composit
ed. |
| 126 // Video does not currently support sharing a backing, but this could be | 126 // Video does not currently support sharing a backing, but this could be |
| 127 // generalized in the future. The following layout tests fail if we permit t
he | 127 // generalized in the future. The following layout tests fail if we permit t
he |
| 128 // video to share a backing with other layers. | 128 // video to share a backing with other layers. |
| 129 // | 129 // |
| 130 // compositing/video/video-controls-layer-creation.html | 130 // compositing/video/video-controls-layer-creation.html |
| 131 if (layer->renderer()->isVideo() || squashingLayer.renderer()->isVideo()) | 131 if (layer->layoutObject()->isVideo() || squashingLayer.layoutObject()->isVid
eo()) |
| 132 return CompositingReasonSquashingVideoIsDisallowed; | 132 return CompositingReasonSquashingVideoIsDisallowed; |
| 133 | 133 |
| 134 // Don't squash iframes, frames or plugins. | 134 // Don't squash iframes, frames or plugins. |
| 135 // FIXME: this is only necessary because there is frame code that assumes th
at composited frames are not squashed. | 135 // FIXME: this is only necessary because there is frame code that assumes th
at composited frames are not squashed. |
| 136 if (layer->renderer()->isLayoutPart() || squashingLayer.renderer()->isLayout
Part()) | 136 if (layer->layoutObject()->isLayoutPart() || squashingLayer.layoutObject()->
isLayoutPart()) |
| 137 return CompositingReasonSquashingLayoutPartIsDisallowed; | 137 return CompositingReasonSquashingLayoutPartIsDisallowed; |
| 138 | 138 |
| 139 if (layer->reflectionInfo()) | 139 if (layer->reflectionInfo()) |
| 140 return CompositingReasonSquashingReflectionIsDisallowed; | 140 return CompositingReasonSquashingReflectionIsDisallowed; |
| 141 | 141 |
| 142 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) | 142 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) |
| 143 return CompositingReasonSquashingSparsityExceeded; | 143 return CompositingReasonSquashingSparsityExceeded; |
| 144 | 144 |
| 145 if (layer->renderer()->style()->hasBlendMode()) | 145 if (layer->layoutObject()->style()->hasBlendMode()) |
| 146 return CompositingReasonSquashingBlendingIsDisallowed; | 146 return CompositingReasonSquashingBlendingIsDisallowed; |
| 147 | 147 |
| 148 // FIXME: this is not efficient, since it walks up the tree. We should store
these values on the CompositingInputsCache. | 148 // FIXME: this is not efficient, since it walks up the tree. We should store
these values on the CompositingInputsCache. |
| 149 if (layer->clippingContainer() != squashingLayer.clippingContainer() && !squ
ashingLayer.compositedLayerMapping()->containingSquashedLayer(layer->clippingCon
tainer(), squashingState.nextSquashedLayerIndex)) | 149 if (layer->clippingContainer() != squashingLayer.clippingContainer() && !squ
ashingLayer.compositedLayerMapping()->containingSquashedLayer(layer->clippingCon
tainer(), squashingState.nextSquashedLayerIndex)) |
| 150 return CompositingReasonSquashingClippingContainerMismatch; | 150 return CompositingReasonSquashingClippingContainerMismatch; |
| 151 | 151 |
| 152 // Composited descendants need to be clipped by a child containment graphics
layer, which would not be available if the layer is | 152 // Composited descendants need to be clipped by a child containment graphics
layer, which would not be available if the layer is |
| 153 // squashed (and therefore has no CLM nor a child containment graphics layer
). | 153 // squashed (and therefore has no CLM nor a child containment graphics layer
). |
| 154 if (m_compositor->clipsCompositingDescendants(layer)) | 154 if (m_compositor->clipsCompositingDescendants(layer)) |
| 155 return CompositingReasonSquashedLayerClipsCompositingDescendants; | 155 return CompositingReasonSquashedLayerClipsCompositingDescendants; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 m_compositor->updateDirectCompositingReasons(reflectionLayer); | 228 m_compositor->updateDirectCompositingReasons(reflectionLayer); |
| 229 | 229 |
| 230 // FIXME: Why do we updateGraphicsLayerConfiguration here instead of in the
GraphicsLayerUpdater? | 230 // FIXME: Why do we updateGraphicsLayerConfiguration here instead of in the
GraphicsLayerUpdater? |
| 231 if (reflectionLayer->hasCompositedLayerMapping()) | 231 if (reflectionLayer->hasCompositedLayerMapping()) |
| 232 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat
ion(); | 232 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat
ion(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) | 235 static ScrollingCoordinator* scrollingCoordinatorFromLayer(Layer& layer) |
| 236 { | 236 { |
| 237 Page* page = layer.renderer()->frame()->page(); | 237 Page* page = layer.layoutObject()->frame()->page(); |
| 238 if (!page) | 238 if (!page) |
| 239 return 0; | 239 return 0; |
| 240 | 240 |
| 241 return page->scrollingCoordinator(); | 241 return page->scrollingCoordinator(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void CompositingLayerAssigner::assignLayersToBackingsInternal(Layer* layer, Squa
shingState& squashingState, Vector<Layer*>& layersNeedingPaintInvalidation) | 244 void CompositingLayerAssigner::assignLayersToBackingsInternal(Layer* layer, Squa
shingState& squashingState, Vector<Layer*>& layersNeedingPaintInvalidation) |
| 245 { | 245 { |
| 246 if (requiresSquashing(layer->compositingReasons())) { | 246 if (requiresSquashing(layer->compositingReasons())) { |
| 247 CompositingReasons reasonsPreventingSquashing = getReasonsPreventingSqua
shing(layer, squashingState); | 247 CompositingReasons reasonsPreventingSquashing = getReasonsPreventingSqua
shing(layer, squashingState); |
| 248 if (reasonsPreventingSquashing) | 248 if (reasonsPreventingSquashing) |
| 249 layer->setCompositingReasons(layer->compositingReasons() | reasonsPr
eventingSquashing); | 249 layer->setCompositingReasons(layer->compositingReasons() | reasonsPr
eventingSquashing); |
| 250 } | 250 } |
| 251 | 251 |
| 252 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye
rUpdate(layer); | 252 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye
rUpdate(layer); |
| 253 | 253 |
| 254 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay
erUpdate)) { | 254 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay
erUpdate)) { |
| 255 TRACE_LAYER_INVALIDATION(layer, InspectorLayerInvalidationTrackingEvent:
:NewCompositedLayer); | 255 TRACE_LAYER_INVALIDATION(layer, InspectorLayerInvalidationTrackingEvent:
:NewCompositedLayer); |
| 256 layersNeedingPaintInvalidation.append(layer); | 256 layersNeedingPaintInvalidation.append(layer); |
| 257 m_layersChanged = true; | 257 m_layersChanged = true; |
| 258 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFro
mLayer(*layer)) { | 258 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFro
mLayer(*layer)) { |
| 259 if (layer->renderer()->style()->hasViewportConstrainedPosition()) | 259 if (layer->layoutObject()->style()->hasViewportConstrainedPosition()
) |
| 260 scrollingCoordinator->frameViewFixedObjectsDidChange(layer->rend
erer()->view()->frameView()); | 260 scrollingCoordinator->frameViewFixedObjectsDidChange(layer->layo
utObject()->view()->frameView()); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 // FIXME: special-casing reflection layers here is not right. | 264 // FIXME: special-casing reflection layers here is not right. |
| 265 if (layer->reflectionInfo()) | 265 if (layer->reflectionInfo()) |
| 266 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec
tionLayer(), layersNeedingPaintInvalidation); | 266 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec
tionLayer(), layersNeedingPaintInvalidation); |
| 267 | 267 |
| 268 // Add this layer to a squashing backing if needed. | 268 // Add this layer to a squashing backing if needed. |
| 269 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate, laye
rsNeedingPaintInvalidation); | 269 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate, laye
rsNeedingPaintInvalidation); |
| 270 | 270 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 296 | 296 |
| 297 LayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildre
n | PositiveZOrderChildren); | 297 LayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildre
n | PositiveZOrderChildren); |
| 298 while (LayerStackingNode* curNode = iterator.next()) | 298 while (LayerStackingNode* curNode = iterator.next()) |
| 299 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersN
eedingPaintInvalidation); | 299 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersN
eedingPaintInvalidation); |
| 300 | 300 |
| 301 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping
->owningLayer() == layer) | 301 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping
->owningLayer() == layer) |
| 302 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; | 302 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; |
| 303 } | 303 } |
| 304 | 304 |
| 305 } | 305 } |
| OLD | NEW |