| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 139 if (layer->layoutObject()->isVideo() || | 139 if (layer->layoutObject().isVideo() || |
| 140 squashingLayer.layoutObject()->isVideo()) | 140 squashingLayer.layoutObject().isVideo()) |
| 141 return SquashingDisallowedReasonSquashingVideoIsDisallowed; | 141 return SquashingDisallowedReasonSquashingVideoIsDisallowed; |
| 142 | 142 |
| 143 // Don't squash iframes, frames or plugins. | 143 // Don't squash iframes, frames or plugins. |
| 144 // FIXME: this is only necessary because there is frame code that assumes that | 144 // FIXME: this is only necessary because there is frame code that assumes that |
| 145 // composited frames are not squashed. | 145 // composited frames are not squashed. |
| 146 if (layer->layoutObject()->isLayoutPart() || | 146 if (layer->layoutObject().isLayoutPart() || |
| 147 squashingLayer.layoutObject()->isLayoutPart()) | 147 squashingLayer.layoutObject().isLayoutPart()) |
| 148 return SquashingDisallowedReasonSquashingLayoutPartIsDisallowed; | 148 return SquashingDisallowedReasonSquashingLayoutPartIsDisallowed; |
| 149 | 149 |
| 150 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) | 150 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) |
| 151 return SquashingDisallowedReasonSquashingSparsityExceeded; | 151 return SquashingDisallowedReasonSquashingSparsityExceeded; |
| 152 | 152 |
| 153 if (layer->layoutObject()->style()->hasBlendMode() || | 153 if (layer->layoutObject().style()->hasBlendMode() || |
| 154 squashingLayer.layoutObject()->style()->hasBlendMode()) | 154 squashingLayer.layoutObject().style()->hasBlendMode()) |
| 155 return SquashingDisallowedReasonSquashingBlendingIsDisallowed; | 155 return SquashingDisallowedReasonSquashingBlendingIsDisallowed; |
| 156 | 156 |
| 157 // FIXME: this is not efficient, since it walks up the tree. We should store | 157 // FIXME: this is not efficient, since it walks up the tree. We should store |
| 158 // these values on the CompositingInputsCache. | 158 // these values on the CompositingInputsCache. |
| 159 if (layer->clippingContainer() != squashingLayer.clippingContainer() && | 159 if (layer->clippingContainer() != squashingLayer.clippingContainer() && |
| 160 !squashingLayer.compositedLayerMapping()->containingSquashedLayer( | 160 !squashingLayer.compositedLayerMapping()->containingSquashedLayer( |
| 161 layer->clippingContainer(), squashingState.nextSquashedLayerIndex)) | 161 layer->clippingContainer(), squashingState.nextSquashedLayerIndex)) |
| 162 return SquashingDisallowedReasonClippingContainerMismatch; | 162 return SquashingDisallowedReasonClippingContainerMismatch; |
| 163 | 163 |
| 164 // Composited descendants need to be clipped by a child containment graphics | 164 // Composited descendants need to be clipped by a child containment graphics |
| (...skipping 20 matching lines...) Expand all 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 DCHECK(layer->layoutObject()->style()->position() != EPosition::kFixed); | 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 |
| 206 if (layer->enclosingPaginationLayer()) | 206 if (layer->enclosingPaginationLayer()) |
| 207 return SquashingDisallowedReasonFragmentedContent; | 207 return SquashingDisallowedReasonFragmentedContent; |
| 208 | 208 |
| 209 return SquashingDisallowedReasonsNone; | 209 return SquashingDisallowedReasonsNone; |
| 210 } | 210 } |
| 211 | 211 |
| 212 void CompositingLayerAssigner::updateSquashingAssignment( | 212 void CompositingLayerAssigner::updateSquashingAssignment( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 layer, | 264 layer, |
| 265 InspectorLayerInvalidationTrackingEvent::RemovedFromSquashingLayer); | 265 InspectorLayerInvalidationTrackingEvent::RemovedFromSquashingLayer); |
| 266 layersNeedingPaintInvalidation.push_back(layer); | 266 layersNeedingPaintInvalidation.push_back(layer); |
| 267 m_layersChanged = true; | 267 m_layersChanged = true; |
| 268 | 268 |
| 269 layer->setLostGroupedMapping(false); | 269 layer->setLostGroupedMapping(false); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer) { | 273 static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer) { |
| 274 Page* page = layer.layoutObject()->frame()->page(); | 274 Page* page = layer.layoutObject().frame()->page(); |
| 275 return (!page) ? nullptr : page->scrollingCoordinator(); | 275 return (!page) ? nullptr : page->scrollingCoordinator(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void CompositingLayerAssigner::assignLayersToBackingsInternal( | 278 void CompositingLayerAssigner::assignLayersToBackingsInternal( |
| 279 PaintLayer* layer, | 279 PaintLayer* layer, |
| 280 SquashingState& squashingState, | 280 SquashingState& squashingState, |
| 281 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { | 281 Vector<PaintLayer*>& layersNeedingPaintInvalidation) { |
| 282 if (requiresSquashing(layer->getCompositingReasons())) { | 282 if (requiresSquashing(layer->getCompositingReasons())) { |
| 283 SquashingDisallowedReasons reasonsPreventingSquashing = | 283 SquashingDisallowedReasons reasonsPreventingSquashing = |
| 284 getReasonsPreventingSquashing(layer, squashingState); | 284 getReasonsPreventingSquashing(layer, squashingState); |
| 285 if (reasonsPreventingSquashing) { | 285 if (reasonsPreventingSquashing) { |
| 286 layer->setCompositingReasons(layer->getCompositingReasons() | | 286 layer->setCompositingReasons(layer->getCompositingReasons() | |
| 287 CompositingReasonSquashingDisallowed); | 287 CompositingReasonSquashingDisallowed); |
| 288 layer->setSquashingDisallowedReasons(reasonsPreventingSquashing); | 288 layer->setSquashingDisallowedReasons(reasonsPreventingSquashing); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 CompositingStateTransitionType compositedLayerUpdate = | 292 CompositingStateTransitionType compositedLayerUpdate = |
| 293 computeCompositedLayerUpdate(layer); | 293 computeCompositedLayerUpdate(layer); |
| 294 | 294 |
| 295 if (m_compositor->allocateOrClearCompositedLayerMapping( | 295 if (m_compositor->allocateOrClearCompositedLayerMapping( |
| 296 layer, compositedLayerUpdate)) { | 296 layer, compositedLayerUpdate)) { |
| 297 TRACE_LAYER_INVALIDATION( | 297 TRACE_LAYER_INVALIDATION( |
| 298 layer, InspectorLayerInvalidationTrackingEvent::NewCompositedLayer); | 298 layer, InspectorLayerInvalidationTrackingEvent::NewCompositedLayer); |
| 299 layersNeedingPaintInvalidation.push_back(layer); | 299 layersNeedingPaintInvalidation.push_back(layer); |
| 300 m_layersChanged = true; | 300 m_layersChanged = true; |
| 301 if (ScrollingCoordinator* scrollingCoordinator = | 301 if (ScrollingCoordinator* scrollingCoordinator = |
| 302 scrollingCoordinatorFromLayer(*layer)) { | 302 scrollingCoordinatorFromLayer(*layer)) { |
| 303 if (layer->layoutObject()->style()->hasViewportConstrainedPosition()) | 303 if (layer->layoutObject().style()->hasViewportConstrainedPosition()) { |
| 304 scrollingCoordinator->frameViewFixedObjectsDidChange( | 304 scrollingCoordinator->frameViewFixedObjectsDidChange( |
| 305 layer->layoutObject()->view()->frameView()); | 305 layer->layoutObject().view()->frameView()); |
| 306 } |
| 306 } | 307 } |
| 307 } | 308 } |
| 308 | 309 |
| 309 // Add this layer to a squashing backing if needed. | 310 // Add this layer to a squashing backing if needed. |
| 310 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate, | 311 updateSquashingAssignment(layer, squashingState, compositedLayerUpdate, |
| 311 layersNeedingPaintInvalidation); | 312 layersNeedingPaintInvalidation); |
| 312 | 313 |
| 313 const bool layerIsSquashed = | 314 const bool layerIsSquashed = |
| 314 compositedLayerUpdate == PutInSquashingLayer || | 315 compositedLayerUpdate == PutInSquashingLayer || |
| 315 (compositedLayerUpdate == NoCompositingStateChange && | 316 (compositedLayerUpdate == NoCompositingStateChange && |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 while (PaintLayerStackingNode* curNode = iterator.next()) | 350 while (PaintLayerStackingNode* curNode = iterator.next()) |
| 350 assignLayersToBackingsInternal(curNode->layer(), squashingState, | 351 assignLayersToBackingsInternal(curNode->layer(), squashingState, |
| 351 layersNeedingPaintInvalidation); | 352 layersNeedingPaintInvalidation); |
| 352 | 353 |
| 353 if (squashingState.hasMostRecentMapping && | 354 if (squashingState.hasMostRecentMapping && |
| 354 &squashingState.mostRecentMapping->owningLayer() == layer) | 355 &squashingState.mostRecentMapping->owningLayer() == layer) |
| 355 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; | 356 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; |
| 356 } | 357 } |
| 357 | 358 |
| 358 } // namespace blink | 359 } // namespace blink |
| OLD | NEW |