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

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

Issue 331203003: Improve the compositing reasons when squashing fails (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (m_compositor->clipsCompositingDescendants(layer)) 143 if (m_compositor->clipsCompositingDescendants(layer))
144 return false; 144 return CompositingReasonSquashingClippingContainerMismatch;
chrishtr 2014/06/16 17:11:05 Not quite accurate. Make another enum value.
Ian Vollick 2014/06/16 17:32:07 Done.
145 145
146 if (layer->scrollsWithRespectTo(&squashingLayer)) 146 if (layer->scrollsWithRespectTo(&squashingLayer))
147 return false; 147 return CompositingReasonScrollsWithRespectToSquashingLayer;
148 148
149 const RenderLayer::CompositingInputs& compositingInputs = layer->compositing Inputs(); 149 const RenderLayer::CompositingInputs& compositingInputs = layer->compositing Inputs();
150 const RenderLayer::CompositingInputs& squashingLayerCompositingInputs = squa shingLayer.compositingInputs(); 150 const RenderLayer::CompositingInputs& squashingLayerCompositingInputs = squa shingLayer.compositingInputs();
151 151
152 if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opa cityAncestor) 152 if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opa cityAncestor)
153 return false; 153 return CompositingReasonSquashingOpacityAncestorMismatch;
154 154
155 if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.t ransformAncestor) 155 if (compositingInputs.transformAncestor != squashingLayerCompositingInputs.t ransformAncestor)
156 return false; 156 return CompositingReasonSquashingTransformAncestorMismatch;
157 157
158 if (compositingInputs.filterAncestor != squashingLayerCompositingInputs.filt erAncestor) 158 if (compositingInputs.filterAncestor != squashingLayerCompositingInputs.filt erAncestor)
159 return false; 159 return CompositingReasonSquashingFilterAncestorMismatch;
160 160
161 return true; 161 return CompositingReasonNone;
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
169 // to paint on top of the background, but below the layer's main contents. F or now, because we always composite layers 169 // 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. 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 if (compositedLayerUpdate == PutInSquashingLayer) { 171 if (compositedLayerUpdate == PutInSquashingLayer) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 layersChanged = true; 215 layersChanged = true;
216 m_compositor->allocateOrClearCompositedLayerMapping(reflectionLayer, com positedLayerUpdate); 216 m_compositor->allocateOrClearCompositedLayerMapping(reflectionLayer, com positedLayerUpdate);
217 } 217 }
218 m_compositor->updateDirectCompositingReasons(reflectionLayer); 218 m_compositor->updateDirectCompositingReasons(reflectionLayer);
219 if (reflectionLayer->hasCompositedLayerMapping()) 219 if (reflectionLayer->hasCompositedLayerMapping())
220 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat ion(GraphicsLayerUpdater::ForceUpdate); 220 reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfigurat ion(GraphicsLayerUpdater::ForceUpdate);
221 } 221 }
222 222
223 void CompositingLayerAssigner::assignLayersToBackingsInternal(RenderLayer* layer , SquashingState& squashingState, bool& layersChanged, Vector<RenderLayer*>& lay ersNeedingRepaint) 223 void CompositingLayerAssigner::assignLayersToBackingsInternal(RenderLayer* layer , SquashingState& squashingState, bool& layersChanged, Vector<RenderLayer*>& lay ersNeedingRepaint)
224 { 224 {
225 if (m_layerSquashingEnabled && requiresSquashing(layer->compositingReasons() ) && !canSquashIntoCurrentSquashingOwner(layer, squashingState)) 225 if (m_layerSquashingEnabled && requiresSquashing(layer->compositingReasons() )) {
226 layer->setCompositingReasons(layer->compositingReasons() | CompositingRe asonNoSquashingTargetFound); 226 CompositingReasons reasonsPreventingSquashing = getReasonsPreventingSqua shing(layer, squashingState);
227 if (reasonsPreventingSquashing)
228 layer->setCompositingReasons(layer->compositingReasons() | reasonsPr eventingSquashing);
229 }
227 230
228 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye rUpdate(layer); 231 CompositingStateTransitionType compositedLayerUpdate = computeCompositedLaye rUpdate(layer);
229 232
230 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay erUpdate)) { 233 if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLay erUpdate)) {
231 layersNeedingRepaint.append(layer); 234 layersNeedingRepaint.append(layer);
232 layersChanged = true; 235 layersChanged = true;
233 } 236 }
234 237
235 // FIXME: special-casing reflection layers here is not right. 238 // FIXME: special-casing reflection layers here is not right.
236 if (layer->reflectionInfo()) 239 if (layer->reflectionInfo())
(...skipping 29 matching lines...) Expand all
266 269
267 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); 270 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren);
268 while (RenderLayerStackingNode* curNode = iterator.next()) 271 while (RenderLayerStackingNode* curNode = iterator.next())
269 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, layersNeedingRepaint); 272 assignLayersToBackingsInternal(curNode->layer(), squashingState, layersC hanged, layersNeedingRepaint);
270 273
271 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping ->owningLayer() == layer) 274 if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping ->owningLayer() == layer)
272 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true; 275 squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree = true;
273 } 276 }
274 277
275 } 278 }
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/CompositingLayerAssigner.h ('k') | Source/platform/graphics/CompositingReasons.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698