| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return update; | 118 return update; |
| 119 } | 119 } |
| 120 | 120 |
| 121 SquashingDisallowedReasons | 121 SquashingDisallowedReasons |
| 122 CompositingLayerAssigner::getReasonsPreventingSquashing( | 122 CompositingLayerAssigner::getReasonsPreventingSquashing( |
| 123 const PaintLayer* layer, | 123 const PaintLayer* layer, |
| 124 const CompositingLayerAssigner::SquashingState& squashingState) { | 124 const CompositingLayerAssigner::SquashingState& squashingState) { |
| 125 if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) | 125 if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree) |
| 126 return SquashingDisallowedReasonWouldBreakPaintOrder; | 126 return SquashingDisallowedReasonWouldBreakPaintOrder; |
| 127 | 127 |
| 128 ASSERT(squashingState.hasMostRecentMapping); | 128 DCHECK(squashingState.hasMostRecentMapping); |
| 129 const PaintLayer& squashingLayer = | 129 const PaintLayer& squashingLayer = |
| 130 squashingState.mostRecentMapping->owningLayer(); | 130 squashingState.mostRecentMapping->owningLayer(); |
| 131 | 131 |
| 132 // FIXME: this special case for video exists only to deal with corner cases | 132 // FIXME: this special case for video exists only to deal with corner cases |
| 133 // where a LayoutVideo does not report that it needs to be directly | 133 // where a LayoutVideo does not report that it needs to be directly |
| 134 // composited. Video does not currently support sharing a backing, but this | 134 // composited. Video does not currently support sharing a backing, but this |
| 135 // could be generalized in the future. The following layout tests fail if we | 135 // could be generalized in the future. The following layout tests fail if we |
| 136 // permit the video to share a backing with other layers. | 136 // permit the video to share a backing with other layers. |
| 137 // | 137 // |
| 138 // compositing/video/video-controls-layer-creation.html | 138 // compositing/video/video-controls-layer-creation.html |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (layer->renderingContextRoot() != squashingLayer.renderingContextRoot()) | 185 if (layer->renderingContextRoot() != squashingLayer.renderingContextRoot()) |
| 186 return SquashingDisallowedReasonRenderingContextMismatch; | 186 return SquashingDisallowedReasonRenderingContextMismatch; |
| 187 | 187 |
| 188 if (layer->hasFilterInducingProperty() || | 188 if (layer->hasFilterInducingProperty() || |
| 189 layer->filterAncestor() != squashingLayer.filterAncestor()) | 189 layer->filterAncestor() != squashingLayer.filterAncestor()) |
| 190 return SquashingDisallowedReasonFilterMismatch; | 190 return SquashingDisallowedReasonFilterMismatch; |
| 191 | 191 |
| 192 if (layer->nearestFixedPositionLayer() != | 192 if (layer->nearestFixedPositionLayer() != |
| 193 squashingLayer.nearestFixedPositionLayer()) | 193 squashingLayer.nearestFixedPositionLayer()) |
| 194 return SquashingDisallowedReasonNearestFixedPositionMismatch; | 194 return SquashingDisallowedReasonNearestFixedPositionMismatch; |
| 195 ASSERT(layer->layoutObject()->style()->position() != FixedPosition); | 195 DCHECK(layer->layoutObject()->style()->position() != EPosition::kFixed); |
| 196 | 196 |
| 197 if ((squashingLayer.layoutObject()->style()->subtreeWillChangeContents() && | 197 if ((squashingLayer.layoutObject()->style()->subtreeWillChangeContents() && |
| 198 squashingLayer.layoutObject() | 198 squashingLayer.layoutObject() |
| 199 ->style() | 199 ->style() |
| 200 ->isRunningAnimationOnCompositor()) || | 200 ->isRunningAnimationOnCompositor()) || |
| 201 squashingLayer.layoutObject() | 201 squashingLayer.layoutObject() |
| 202 ->style() | 202 ->style() |
| 203 ->shouldCompositeForCurrentAnimations()) | 203 ->shouldCompositeForCurrentAnimations()) |
| 204 return SquashingDisallowedReasonSquashingLayerIsAnimating; | 204 return SquashingDisallowedReasonSquashingLayerIsAnimating; |
| 205 | 205 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 217 // NOTE: In the future as we generalize this, the background of this layer may | 217 // NOTE: In the future as we generalize this, the background of this layer may |
| 218 // need to be assigned to a different backing than the squashed PaintLayer's | 218 // need to be assigned to a different backing than the squashed PaintLayer's |
| 219 // own primary contents. This would happen when we have a composited negative | 219 // own primary contents. This would happen when we have a composited negative |
| 220 // z-index element that needs to paint on top of the background, but below the | 220 // z-index element that needs to paint on top of the background, but below the |
| 221 // layer's main contents. For now, because we always composite layers when | 221 // layer's main contents. For now, because we always composite layers when |
| 222 // they have a composited negative z-index child, such layers will never need | 222 // they have a composited negative z-index child, such layers will never need |
| 223 // squashing so it is not yet an issue. | 223 // squashing so it is not yet an issue. |
| 224 if (compositedLayerUpdate == PutInSquashingLayer) { | 224 if (compositedLayerUpdate == PutInSquashingLayer) { |
| 225 // A layer that is squashed with other layers cannot have its own | 225 // A layer that is squashed with other layers cannot have its own |
| 226 // CompositedLayerMapping. | 226 // CompositedLayerMapping. |
| 227 ASSERT(!layer->hasCompositedLayerMapping()); | 227 DCHECK(!layer->hasCompositedLayerMapping()); |
| 228 ASSERT(squashingState.hasMostRecentMapping); | 228 DCHECK(squashingState.hasMostRecentMapping); |
| 229 | 229 |
| 230 bool changedSquashingLayer = | 230 bool changedSquashingLayer = |
| 231 squashingState.mostRecentMapping->updateSquashingLayerAssignment( | 231 squashingState.mostRecentMapping->updateSquashingLayerAssignment( |
| 232 layer, squashingState.nextSquashedLayerIndex); | 232 layer, squashingState.nextSquashedLayerIndex); |
| 233 if (!changedSquashingLayer) | 233 if (!changedSquashingLayer) |
| 234 return; | 234 return; |
| 235 | 235 |
| 236 // If we've modified the collection of squashed layers, we must update | 236 // If we've modified the collection of squashed layers, we must update |
| 237 // the graphics layer geometry. | 237 // the graphics layer geometry. |
| 238 squashingState.mostRecentMapping->setNeedsGraphicsLayerUpdate( | 238 squashingState.mostRecentMapping->setNeedsGraphicsLayerUpdate( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), | 325 PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), |
| 326 NegativeZOrderChildren); | 326 NegativeZOrderChildren); |
| 327 while (PaintLayerStackingNode* curNode = iterator.next()) | 327 while (PaintLayerStackingNode* curNode = iterator.next()) |
| 328 assignLayersToBackingsInternal(curNode->layer(), squashingState, | 328 assignLayersToBackingsInternal(curNode->layer(), squashingState, |
| 329 layersNeedingPaintInvalidation); | 329 layersNeedingPaintInvalidation); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // At this point, if the layer is to be separately composited, then its | 332 // At this point, if the layer is to be separately composited, then its |
| 333 // backing becomes the most recent in paint-order. | 333 // backing becomes the most recent in paint-order. |
| 334 if (layer->compositingState() == PaintsIntoOwnBacking) { | 334 if (layer->compositingState() == PaintsIntoOwnBacking) { |
| 335 ASSERT(!requiresSquashing(layer->getCompositingReasons())); | 335 DCHECK(!requiresSquashing(layer->getCompositingReasons())); |
| 336 squashingState.updateSquashingStateForNewMapping( | 336 squashingState.updateSquashingStateForNewMapping( |
| 337 layer->compositedLayerMapping(), layer->hasCompositedLayerMapping(), | 337 layer->compositedLayerMapping(), layer->hasCompositedLayerMapping(), |
| 338 layersNeedingPaintInvalidation); | 338 layersNeedingPaintInvalidation); |
| 339 } | 339 } |
| 340 | 340 |
| 341 if (layer->scrollParent()) | 341 if (layer->scrollParent()) |
| 342 layer->scrollParent()->getScrollableArea()->setTopmostScrollChild(layer); | 342 layer->scrollParent()->getScrollableArea()->setTopmostScrollChild(layer); |
| 343 | 343 |
| 344 if (layer->needsCompositedScrolling()) | 344 if (layer->needsCompositedScrolling()) |
| 345 layer->getScrollableArea()->setTopmostScrollChild(nullptr); | 345 layer->getScrollableArea()->setTopmostScrollChild(nullptr); |
| 346 | 346 |
| 347 PaintLayerStackingNodeIterator iterator( | 347 PaintLayerStackingNodeIterator iterator( |
| 348 *layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren); | 348 *layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren); |
| 349 while (PaintLayerStackingNode* curNode = iterator.next()) | 349 while (PaintLayerStackingNode* curNode = iterator.next()) |
| 350 assignLayersToBackingsInternal(curNode->layer(), squashingState, | 350 assignLayersToBackingsInternal(curNode->layer(), squashingState, |
| 351 layersNeedingPaintInvalidation); | 351 layersNeedingPaintInvalidation); |
| 352 | 352 |
| 353 if (squashingState.hasMostRecentMapping && | 353 if (squashingState.hasMostRecentMapping && |
| 354 &squashingState.mostRecentMapping->owningLayer() == layer) | 354 &squashingState.mostRecentMapping->owningLayer() == layer) |
| 355 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; | 355 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace blink | 358 } // namespace blink |
| OLD | NEW |