Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: Source/core/rendering/compositing/CompositingLayerAssigner.cpp

Issue 322163003: Rename AncestorDependentProperties to CompositingInputs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moar renaming Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 nextSquashedLayerIndex = 0; 62 nextSquashedLayerIndex = 0;
63 boundingRect = IntRect(); 63 boundingRect = IntRect();
64 mostRecentMapping = newCompositedLayerMapping; 64 mostRecentMapping = newCompositedLayerMapping;
65 hasMostRecentMapping = hasNewCompositedLayerMapping; 65 hasMostRecentMapping = hasNewCompositedLayerMapping;
66 haveAssignedBackingsToEntireSquashingLayerSubtree = false; 66 haveAssignedBackingsToEntireSquashingLayerSubtree = false;
67 } 67 }
68 68
69 bool CompositingLayerAssigner::squashingWouldExceedSparsityTolerance(const Rende rLayer* candidate, const CompositingLayerAssigner::SquashingState& squashingStat e) 69 bool CompositingLayerAssigner::squashingWouldExceedSparsityTolerance(const Rende rLayer* candidate, const CompositingLayerAssigner::SquashingState& squashingStat e)
70 { 70 {
71 IntRect bounds = candidate->ancestorDependentProperties().clippedAbsoluteBou ndingBox; 71 IntRect bounds = candidate->compositingInputs().clippedAbsoluteBoundingBox;
72 IntRect newBoundingRect = squashingState.boundingRect; 72 IntRect newBoundingRect = squashingState.boundingRect;
73 newBoundingRect.unite(bounds); 73 newBoundingRect.unite(bounds);
74 const uint64_t newBoundingRectArea = newBoundingRect.size().area(); 74 const uint64_t newBoundingRectArea = newBoundingRect.size().area();
75 const uint64_t newSquashedArea = squashingState.totalAreaOfSquashedRects + b ounds.size().area(); 75 const uint64_t newSquashedArea = squashingState.totalAreaOfSquashedRects + b ounds.size().area();
76 return newBoundingRectArea > gSquashingSparsityTolerance * newSquashedArea; 76 return newBoundingRectArea > gSquashingSparsityTolerance * newSquashedArea;
77 } 77 }
78 78
79 bool CompositingLayerAssigner::needsOwnBacking(const RenderLayer* layer) const 79 bool CompositingLayerAssigner::needsOwnBacking(const RenderLayer* layer) const
80 { 80 {
81 if (!m_compositor->canBeComposited(layer)) 81 if (!m_compositor->canBeComposited(layer))
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 false;
129 129
130 if (squashingWouldExceedSparsityTolerance(layer, squashingState)) 130 if (squashingWouldExceedSparsityTolerance(layer, squashingState))
131 return false; 131 return false;
132 132
133 // FIXME: this is not efficient, since it walks up the tree . We should stor e these values on the AncestorDependentPropertiesCache. 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 false;
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 contianment graphics layer, which would not be available if the layer is
143 if (m_compositor->clipsCompositingDescendants(layer)) 143 if (m_compositor->clipsCompositingDescendants(layer))
144 return false; 144 return false;
145 145
146 if (layer->scrollsWithRespectTo(&squashingLayer)) 146 if (layer->scrollsWithRespectTo(&squashingLayer))
147 return false; 147 return false;
148 148
149 const RenderLayer::AncestorDependentProperties& ancestorDependentProperties = layer->ancestorDependentProperties(); 149 const RenderLayer::CompositingInputs& compositingInputs = layer->compositing Inputs();
150 const RenderLayer::AncestorDependentProperties& squashingLayerAncestorDepend entProperties = squashingLayer.ancestorDependentProperties(); 150 const RenderLayer::CompositingInputs& squashingLayerCompositingInputs = squa shingLayer.compositingInputs();
151 151
152 if (ancestorDependentProperties.opacityAncestor != squashingLayerAncestorDep endentProperties.opacityAncestor) 152 if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opa cityAncestor)
153 return false; 153 return false;
154 154
155 if (ancestorDependentProperties.transformAncestor != squashingLayerAncestorD ependentProperties.transformAncestor) 155 if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.t ransformAncestor)
156 return false; 156 return false;
157 157
158 if (ancestorDependentProperties.filterAncestor != squashingLayerAncestorDepe ndentProperties.filterAncestor) 158 if (compositingInputs.filterAncestor != squashingLayerCompositingInputs.filt erAncestor)
159 return false; 159 return false;
160 160
161 return true; 161 return true;
162 } 162 }
163 163
164 bool CompositingLayerAssigner::updateSquashingAssignment(RenderLayer* layer, Squ ashingState& squashingState, const CompositingStateTransitionType compositedLaye rUpdate, 164 bool CompositingLayerAssigner::updateSquashingAssignment(RenderLayer* layer, Squ ashingState& squashingState, const CompositingStateTransitionType compositedLaye rUpdate,
165 Vector<RenderLayer*>& layersNeedingRepaint) 165 Vector<RenderLayer*>& layersNeedingRepaint)
166 { 166 {
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 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 // the squashed RenderLayer's own primary contents. This would happen when w e have a composited negative z-index element that needs 168 // the squashed RenderLayer's own primary contents. This would happen when w e have a composited negative z-index element that needs
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec tionLayer(), layersChanged, layersNeedingRepaint); 237 assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflec tionLayer(), layersChanged, layersNeedingRepaint);
238 238
239 // Add this layer to a squashing backing if needed. 239 // Add this layer to a squashing backing if needed.
240 if (m_layerSquashingEnabled) { 240 if (m_layerSquashingEnabled) {
241 if (updateSquashingAssignment(layer, squashingState, compositedLayerUpda te, layersNeedingRepaint)) 241 if (updateSquashingAssignment(layer, squashingState, compositedLayerUpda te, layersNeedingRepaint))
242 layersChanged = true; 242 layersChanged = true;
243 243
244 const bool layerIsSquashed = compositedLayerUpdate == PutInSquashingLaye r || (compositedLayerUpdate == NoCompositingStateChange && layer->groupedMapping ()); 244 const bool layerIsSquashed = compositedLayerUpdate == PutInSquashingLaye r || (compositedLayerUpdate == NoCompositingStateChange && layer->groupedMapping ());
245 if (layerIsSquashed) { 245 if (layerIsSquashed) {
246 squashingState.nextSquashedLayerIndex++; 246 squashingState.nextSquashedLayerIndex++;
247 IntRect layerBounds = layer->ancestorDependentProperties().clippedAb soluteBoundingBox; 247 IntRect layerBounds = layer->compositingInputs().clippedAbsoluteBoun dingBox;
248 squashingState.totalAreaOfSquashedRects += layerBounds.size().area() ; 248 squashingState.totalAreaOfSquashedRects += layerBounds.size().area() ;
249 squashingState.boundingRect.unite(layerBounds); 249 squashingState.boundingRect.unite(layerBounds);
250 } 250 }
251 } 251 }
252 252
253 if (layer->stackingNode()->isStackingContext()) { 253 if (layer->stackingNode()->isStackingContext()) {
254 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); 254 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren);
255 while (RenderLayerStackingNode* curNode = iterator.next()) 255 while (RenderLayerStackingNode* curNode = iterator.next())
256 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged, layersNeedingRepaint); 256 assignLayersToBackingsInternal(curNode->layer(), squashingState, lay ersChanged, layersNeedingRepaint);
257 } 257 }
258 258
259 if (m_layerSquashingEnabled) { 259 if (m_layerSquashingEnabled) {
260 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order. 260 // At this point, if the layer is to be "separately" composited, then it s backing becomes the most recent in paint-order.
261 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) { 261 if (layer->compositingState() == PaintsIntoOwnBacking || layer->composit ingState() == HasOwnBackingButPaintsIntoAncestor) {
262 ASSERT(!requiresSquashing(layer->compositingReasons())); 262 ASSERT(!requiresSquashing(layer->compositingReasons()));
263 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping()); 263 squashingState.updateSquashingStateForNewMapping(layer->compositedLa yerMapping(), layer->hasCompositedLayerMapping());
264 } 264 }
265 } 265 }
266 266
267 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); 267 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren);
268 while (RenderLayerStackingNode* curNode = iterator.next()) 268 while (RenderLayerStackingNode* curNode = iterator.next())
269 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, layersNeedingRepaint); 269 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, layersNeedingRepaint);
270 270
271 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping ->owningLayer() == layer) 271 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping ->owningLayer() == layer)
272 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; 272 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true;
273 } 273 }
274 274
275 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698