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

Side by Side Diff: Source/core/layout/compositing/CompositingRequirementsUpdater.cpp

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/layout/compositing/CompositingRequirementsUpdater.h" 28 #include "core/layout/compositing/CompositingRequirementsUpdater.h"
29 29
30 #include "core/layout/compositing/RenderLayerCompositor.h" 30 #include "core/layout/LayerStackingNode.h"
31 #include "core/rendering/RenderLayerStackingNode.h" 31 #include "core/layout/LayerStackingNodeIterator.h"
32 #include "core/rendering/RenderLayerStackingNodeIterator.h" 32 #include "core/layout/compositing/LayerCompositor.h"
33 #include "core/rendering/RenderView.h" 33 #include "core/rendering/RenderView.h"
34 #include "platform/TraceEvent.h" 34 #include "platform/TraceEvent.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class OverlapMapContainer { 38 class OverlapMapContainer {
39 public: 39 public:
40 void add(const IntRect& bounds) 40 void add(const IntRect& bounds)
41 { 41 {
42 m_layerRects.append(bounds); 42 m_layerRects.append(bounds);
(...skipping 28 matching lines...) Expand all
71 WTF_MAKE_NONCOPYABLE(OverlapMap); 71 WTF_MAKE_NONCOPYABLE(OverlapMap);
72 public: 72 public:
73 OverlapMap() 73 OverlapMap()
74 { 74 {
75 // Begin by assuming the root layer will be composited so that there 75 // Begin by assuming the root layer will be composited so that there
76 // is something on the stack. The root layer should also never get a 76 // is something on the stack. The root layer should also never get a
77 // finishCurrentOverlapTestingContext() call. 77 // finishCurrentOverlapTestingContext() call.
78 beginNewOverlapTestingContext(); 78 beginNewOverlapTestingContext();
79 } 79 }
80 80
81 void add(RenderLayer* layer, const IntRect& bounds) 81 void add(Layer* layer, const IntRect& bounds)
82 { 82 {
83 ASSERT(!layer->isRootLayer()); 83 ASSERT(!layer->isRootLayer());
84 if (bounds.isEmpty()) 84 if (bounds.isEmpty())
85 return; 85 return;
86 86
87 // Layers do not contribute to overlap immediately--instead, they will 87 // Layers do not contribute to overlap immediately--instead, they will
88 // contribute to overlap as soon as they have been recursively processed 88 // contribute to overlap as soon as they have been recursively processed
89 // and popped off the stack. 89 // and popped off the stack.
90 ASSERT(m_overlapStack.size() >= 2); 90 ASSERT(m_overlapStack.size() >= 2);
91 m_overlapStack[m_overlapStack.size() - 2].add(bounds); 91 m_overlapStack[m_overlapStack.size() - 2].add(bounds);
(...skipping 24 matching lines...) Expand all
116 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); 116 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last());
117 m_overlapStack.removeLast(); 117 m_overlapStack.removeLast();
118 } 118 }
119 119
120 private: 120 private:
121 Vector<OverlapMapContainer> m_overlapStack; 121 Vector<OverlapMapContainer> m_overlapStack;
122 }; 122 };
123 123
124 class CompositingRequirementsUpdater::RecursionData { 124 class CompositingRequirementsUpdater::RecursionData {
125 public: 125 public:
126 explicit RecursionData(RenderLayer* compositingAncestor) 126 explicit RecursionData(Layer* compositingAncestor)
127 : m_compositingAncestor(compositingAncestor) 127 : m_compositingAncestor(compositingAncestor)
128 , m_subtreeIsCompositing(false) 128 , m_subtreeIsCompositing(false)
129 , m_hasUnisolatedCompositedBlendingDescendant(false) 129 , m_hasUnisolatedCompositedBlendingDescendant(false)
130 , m_testingOverlap(true) 130 , m_testingOverlap(true)
131 { 131 {
132 } 132 }
133 133
134 RenderLayer* m_compositingAncestor; 134 Layer* m_compositingAncestor;
135 bool m_subtreeIsCompositing; 135 bool m_subtreeIsCompositing;
136 bool m_hasUnisolatedCompositedBlendingDescendant; 136 bool m_hasUnisolatedCompositedBlendingDescendant;
137 bool m_testingOverlap; 137 bool m_testingOverlap;
138 }; 138 };
139 139
140 static bool requiresCompositingOrSquashing(CompositingReasons reasons) 140 static bool requiresCompositingOrSquashing(CompositingReasons reasons)
141 { 141 {
142 #if ENABLE(ASSERT) 142 #if ENABLE(ASSERT)
143 bool fastAnswer = reasons != CompositingReasonNone; 143 bool fastAnswer = reasons != CompositingReasonNone;
144 bool slowAnswer = requiresCompositing(reasons) || requiresSquashing(reasons) ; 144 bool slowAnswer = requiresCompositing(reasons) || requiresSquashing(reasons) ;
145 ASSERT(fastAnswer == slowAnswer); 145 ASSERT(fastAnswer == slowAnswer);
146 #endif 146 #endif
147 return reasons != CompositingReasonNone; 147 return reasons != CompositingReasonNone;
148 } 148 }
149 149
150 static CompositingReasons subtreeReasonsForCompositing(RenderLayer* layer, bool hasCompositedDescendants, bool has3DTransformedDescendants) 150 static CompositingReasons subtreeReasonsForCompositing(Layer* layer, bool hasCom positedDescendants, bool has3DTransformedDescendants)
151 { 151 {
152 CompositingReasons subtreeReasons = CompositingReasonNone; 152 CompositingReasons subtreeReasons = CompositingReasonNone;
153 153
154 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented 154 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented
155 // via compositing so that they also apply to those composited descdendants. 155 // via compositing so that they also apply to those composited descdendants.
156 if (hasCompositedDescendants) { 156 if (hasCompositedDescendants) {
157 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos itingReasonComboCompositedDescendants; 157 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos itingReasonComboCompositedDescendants;
158 158
159 if (layer->shouldIsolateCompositedDescendants()) { 159 if (layer->shouldIsolateCompositedDescendants()) {
160 ASSERT(layer->stackingNode()->isStackingContext()); 160 ASSERT(layer->stackingNode()->isStackingContext());
(...skipping 17 matching lines...) Expand all
178 CompositingRequirementsUpdater::CompositingRequirementsUpdater(RenderView& rende rView, CompositingReasonFinder& compositingReasonFinder) 178 CompositingRequirementsUpdater::CompositingRequirementsUpdater(RenderView& rende rView, CompositingReasonFinder& compositingReasonFinder)
179 : m_renderView(renderView) 179 : m_renderView(renderView)
180 , m_compositingReasonFinder(compositingReasonFinder) 180 , m_compositingReasonFinder(compositingReasonFinder)
181 { 181 {
182 } 182 }
183 183
184 CompositingRequirementsUpdater::~CompositingRequirementsUpdater() 184 CompositingRequirementsUpdater::~CompositingRequirementsUpdater()
185 { 185 {
186 } 186 }
187 187
188 void CompositingRequirementsUpdater::update(RenderLayer* root) 188 void CompositingRequirementsUpdater::update(Layer* root)
189 { 189 {
190 TRACE_EVENT0("blink", "CompositingRequirementsUpdater::updateRecursive"); 190 TRACE_EVENT0("blink", "CompositingRequirementsUpdater::updateRecursive");
191 191
192 // Go through the layers in presentation order, so that we can compute which RenderLayers need compositing layers. 192 // Go through the layers in presentation order, so that we can compute which Layers need compositing layers.
193 // FIXME: we could maybe do this and the hierarchy update in one pass, but t he parenting logic would be more complex. 193 // FIXME: we could maybe do this and the hierarchy update in one pass, but t he parenting logic would be more complex.
194 RecursionData recursionData(root); 194 RecursionData recursionData(root);
195 OverlapMap overlapTestRequestMap; 195 OverlapMap overlapTestRequestMap;
196 bool saw3DTransform = false; 196 bool saw3DTransform = false;
197 197
198 // FIXME: Passing these unclippedDescendants down and keeping track 198 // FIXME: Passing these unclippedDescendants down and keeping track
199 // of them dynamically, we are requiring a full tree walk. This 199 // of them dynamically, we are requiring a full tree walk. This
200 // should be removed as soon as proper overlap testing based on 200 // should be removed as soon as proper overlap testing based on
201 // scrolling and animation bounds is implemented (crbug.com/252472). 201 // scrolling and animation bounds is implemented (crbug.com/252472).
202 Vector<RenderLayer*> unclippedDescendants; 202 Vector<Layer*> unclippedDescendants;
203 IntRect absoluteDecendantBoundingBox; 203 IntRect absoluteDecendantBoundingBox;
204 updateRecursive(0, root, overlapTestRequestMap, recursionData, saw3DTransfor m, unclippedDescendants, absoluteDecendantBoundingBox); 204 updateRecursive(0, root, overlapTestRequestMap, recursionData, saw3DTransfor m, unclippedDescendants, absoluteDecendantBoundingBox);
205 } 205 }
206 206
207 void CompositingRequirementsUpdater::updateRecursive(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap& overlapMap, RecursionData& currentRecursionData , bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants, In tRect& absoluteDecendantBoundingBox) 207 void CompositingRequirementsUpdater::updateRecursive(Layer* ancestorLayer, Layer * layer, OverlapMap& overlapMap, RecursionData& currentRecursionData, bool& desc endantHas3DTransform, Vector<Layer*>& unclippedDescendants, IntRect& absoluteDec endantBoundingBox)
208 { 208 {
209 RenderLayerCompositor* compositor = m_renderView.compositor(); 209 LayerCompositor* compositor = m_renderView.compositor();
210 210
211 layer->stackingNode()->updateLayerListsIfNeeded(); 211 layer->stackingNode()->updateLayerListsIfNeeded();
212 212
213 CompositingReasons reasonsToComposite = CompositingReasonNone; 213 CompositingReasons reasonsToComposite = CompositingReasonNone;
214 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer); 214 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l ayer);
215 215
216 // Video is special. It's the only RenderLayer type that can both have 216 // Video is special. It's the only Layer type that can both have
217 // RenderLayer children and whose children can't use its backing to render 217 // Layer children and whose children can't use its backing to render
218 // into. These children (the controls) always need to be promoted into their 218 // into. These children (the controls) always need to be promoted into their
219 // own layers to draw on top of the accelerated video. 219 // own layers to draw on top of the accelerated video.
220 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com positingAncestor->renderer()->isVideo()) 220 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com positingAncestor->renderer()->isVideo())
221 directReasons |= CompositingReasonVideoOverlay; 221 directReasons |= CompositingReasonVideoOverlay;
222 222
223 if (compositor->canBeComposited(layer)) { 223 if (compositor->canBeComposited(layer)) {
224 reasonsToComposite |= directReasons; 224 reasonsToComposite |= directReasons;
225 225
226 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) 226 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite())
227 reasonsToComposite |= CompositingReasonRoot; 227 reasonsToComposite |= CompositingReasonRoot;
228 228
229 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo sitedScrolling()) { 229 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo sitedScrolling()) {
230 // We will only set needsCompositedScrolling if we don't care about 230 // We will only set needsCompositedScrolling if we don't care about
231 // the LCD text hit, we may be able to switch to the compositor 231 // the LCD text hit, we may be able to switch to the compositor
232 // driven path if we're alread composited for other reasons and are 232 // driven path if we're alread composited for other reasons and are
233 // therefore using grayscale AA. 233 // therefore using grayscale AA.
234 // 234 //
235 // FIXME: it should also be possible to promote if the layer can 235 // FIXME: it should also be possible to promote if the layer can
236 // still use LCD text when promoted, but detecting when the 236 // still use LCD text when promoted, but detecting when the
237 // compositor can do this is tricky. Currently, the layer must be 237 // compositor can do this is tricky. Currently, the layer must be
238 // both opaque and may only have an integer translation as its 238 // both opaque and may only have an integer translation as its
239 // transform. Both opacity and screen space transform are inherited 239 // transform. Both opacity and screen space transform are inherited
240 // properties, so this cannot be determined from local information. 240 // properties, so this cannot be determined from local information.
241 layer->scrollableArea()->updateNeedsCompositedScrolling(RenderLayerS crollableArea::IgnoreLCDText); 241 layer->scrollableArea()->updateNeedsCompositedScrolling(LayerScrolla bleArea::IgnoreLCDText);
242 if (layer->needsCompositedScrolling()) 242 if (layer->needsCompositedScrolling())
243 reasonsToComposite |= CompositingReasonOverflowScrollingTouch; 243 reasonsToComposite |= CompositingReasonOverflowScrollingTouch;
244 } 244 }
245 } 245 }
246 246
247 // Next, accumulate reasons related to overlap. 247 // Next, accumulate reasons related to overlap.
248 // If overlap testing is used, this reason will be overridden. If overlap te sting is not 248 // If overlap testing is used, this reason will be overridden. If overlap te sting is not
249 // used, we must assume we overlap if there is anything composited behind us in paint-order. 249 // used, we must assume we overlap if there is anything composited behind us in paint-order.
250 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone; 250 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone;
251 251
252 if (m_renderView.compositor()->preferCompositingToLCDTextEnabled()) { 252 if (m_renderView.compositor()->preferCompositingToLCDTextEnabled()) {
253 Vector<size_t> unclippedDescendantsToRemove; 253 Vector<size_t> unclippedDescendantsToRemove;
254 for (size_t i = 0; i < unclippedDescendants.size(); i++) { 254 for (size_t i = 0; i < unclippedDescendants.size(); i++) {
255 RenderLayer* unclippedDescendant = unclippedDescendants.at(i); 255 Layer* unclippedDescendant = unclippedDescendants.at(i);
256 // If we've reached the containing block of one of the unclipped 256 // If we've reached the containing block of one of the unclipped
257 // descendants, that element is no longer relevant to whether or not we 257 // descendants, that element is no longer relevant to whether or not we
258 // should opt in. Unfortunately we can't easily remove from the list 258 // should opt in. Unfortunately we can't easily remove from the list
259 // while we're iterating, so we have to store it for later removal. 259 // while we're iterating, so we have to store it for later removal.
260 if (unclippedDescendant->renderer()->containingBlock() == layer->ren derer()) { 260 if (unclippedDescendant->renderer()->containingBlock() == layer->ren derer()) {
261 unclippedDescendantsToRemove.append(i); 261 unclippedDescendantsToRemove.append(i);
262 continue; 262 continue;
263 } 263 }
264 if (layer->scrollsWithRespectTo(unclippedDescendant)) 264 if (layer->scrollsWithRespectTo(unclippedDescendant))
265 reasonsToComposite |= CompositingReasonAssumedOverlap; 265 reasonsToComposite |= CompositingReasonAssumedOverlap;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 306
307 #if ENABLE(ASSERT) 307 #if ENABLE(ASSERT)
308 LayerListMutationDetector mutationChecker(layer->stackingNode()); 308 LayerListMutationDetector mutationChecker(layer->stackingNode());
309 #endif 309 #endif
310 310
311 bool anyDescendantHas3DTransform = false; 311 bool anyDescendantHas3DTransform = false;
312 bool willHaveForegroundLayer = false; 312 bool willHaveForegroundLayer = false;
313 313
314 if (layer->stackingNode()->isStackingContext()) { 314 if (layer->stackingNode()->isStackingContext()) {
315 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); 315 LayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrde rChildren);
316 while (RenderLayerStackingNode* curNode = iterator.next()) { 316 while (LayerStackingNode* curNode = iterator.next()) {
317 IntRect absoluteChildDecendantBoundingBox; 317 IntRect absoluteChildDecendantBoundingBox;
318 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionD ata, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBo undingBox); 318 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionD ata, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBo undingBox);
319 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox ); 319 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox );
320 320
321 // If we have to make a layer for this child, make one now so we can have a contents layer 321 // If we have to make a layer for this child, make one now so we can have a contents layer
322 // (since we need to ensure that the -ve z-order child renders under neath our contents). 322 // (since we need to ensure that the -ve z-order child renders under neath our contents).
323 if (childRecursionData.m_subtreeIsCompositing) { 323 if (childRecursionData.m_subtreeIsCompositing) {
324 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; 324 reasonsToComposite |= CompositingReasonNegativeZIndexChildren;
325 325
326 if (!willBeCompositedOrSquashed) { 326 if (!willBeCompositedOrSquashed) {
(...skipping 20 matching lines...) Expand all
347 // we don't need to test for overlap with anything behind this. So, we c an finish 347 // we don't need to test for overlap with anything behind this. So, we c an finish
348 // the previous context that was accumulating rects for the negative z-i ndex 348 // the previous context that was accumulating rects for the negative z-i ndex
349 // children, and start with a fresh new empty context. 349 // children, and start with a fresh new empty context.
350 overlapMap.finishCurrentOverlapTestingContext(); 350 overlapMap.finishCurrentOverlapTestingContext();
351 overlapMap.beginNewOverlapTestingContext(); 351 overlapMap.beginNewOverlapTestingContext();
352 // This layer is going to be composited, so children can safely ignore t he fact that there's an 352 // This layer is going to be composited, so children can safely ignore t he fact that there's an
353 // animation running behind this layer, meaning they can rely on the ove rlap map testing again 353 // animation running behind this layer, meaning they can rely on the ove rlap map testing again
354 childRecursionData.m_testingOverlap = true; 354 childRecursionData.m_testingOverlap = true;
355 } 355 }
356 356
357 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); 357 LayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildre n | PositiveZOrderChildren);
358 while (RenderLayerStackingNode* curNode = iterator.next()) { 358 while (LayerStackingNode* curNode = iterator.next()) {
359 IntRect absoluteChildDecendantBoundingBox; 359 IntRect absoluteChildDecendantBoundingBox;
360 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBoundi ngBox); 360 updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBoundi ngBox);
361 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox); 361 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox);
362 } 362 }
363 363
364 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree. 364 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree.
365 365
366 if (layer->stackingNode()->isStackingContext()) { 366 if (layer->stackingNode()->isStackingContext()) {
367 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant); 367 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant);
368 } else { 368 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 overlapMap.add(layer, absoluteDecendantBoundingBox); 405 overlapMap.add(layer, absoluteDecendantBoundingBox);
406 willBeCompositedOrSquashed = true; 406 willBeCompositedOrSquashed = true;
407 } 407 }
408 408
409 if (willBeCompositedOrSquashed) 409 if (willBeCompositedOrSquashed)
410 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & CompositingReasonInlineTransform; 410 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & CompositingReasonInlineTransform;
411 411
412 // If the original layer is composited, the reflection needs to be, too. 412 // If the original layer is composited, the reflection needs to be, too.
413 if (layer->reflectionInfo()) { 413 if (layer->reflectionInfo()) {
414 // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer? 414 // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer?
415 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLa yer(); 415 Layer* reflectionLayer = layer->reflectionInfo()->reflectionLayer();
416 CompositingReasons reflectionCompositingReason = willBeCompositedOrS quashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; 416 CompositingReasons reflectionCompositingReason = willBeCompositedOrS quashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone;
417 reflectionLayer->setCompositingReasons(reflectionCompositingReason, CompositingReasonReflectionOfCompositedParent); 417 reflectionLayer->setCompositingReasons(reflectionCompositingReason, CompositingReasonReflectionOfCompositedParent);
418 } 418 }
419 419
420 if (willBeCompositedOrSquashed && layer->renderer()->style()->hasBlendMo de()) 420 if (willBeCompositedOrSquashed && layer->renderer()->style()->hasBlendMo de())
421 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = t rue; 421 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = t rue;
422 422
423 // Turn overlap testing off for later layers if it's already off, or if we have an animating transform. 423 // Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
424 // Note that if the layer clips its descendants, there's no reason to pr opagate the child animation to the parent layers. That's because 424 // Note that if the layer clips its descendants, there's no reason to pr opagate the child animation to the parent layers. That's because
425 // we know for sure the animation is contained inside the clipping recta ngle, which is already added to the overlap map. 425 // we know for sure the animation is contained inside the clipping recta ngle, which is already added to the overlap map.
426 bool isCompositedClippingLayer = compositor->canBeComposited(layer) && ( reasonsToComposite & CompositingReasonClipsCompositingDescendants); 426 bool isCompositedClippingLayer = compositor->canBeComposited(layer) && ( reasonsToComposite & CompositingReasonClipsCompositingDescendants);
427 bool isCompositedWithInlineTransform = reasonsToComposite & CompositingR easonInlineTransform; 427 bool isCompositedWithInlineTransform = reasonsToComposite & CompositingR easonInlineTransform;
428 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || layer->renderer()->style()->hasCurrentTransformAnimation() || isCompositedWi thInlineTransform) 428 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || layer->renderer()->style()->hasCurrentTransformAnimation() || isCompositedWi thInlineTransform)
429 currentRecursionData.m_testingOverlap = false; 429 currentRecursionData.m_testingOverlap = false;
430 430
431 if (childRecursionData.m_compositingAncestor == layer) 431 if (childRecursionData.m_compositingAncestor == layer)
432 overlapMap.finishCurrentOverlapTestingContext(); 432 overlapMap.finishCurrentOverlapTestingContext();
433 433
434 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); 434 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform();
435 } 435 }
436 436
437 // At this point we have finished collecting all reasons to composite this l ayer. 437 // At this point we have finished collecting all reasons to composite this l ayer.
438 layer->setCompositingReasons(reasonsToComposite); 438 layer->setCompositingReasons(reasonsToComposite);
439 439
440 } 440 }
441 441
442 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositingRequirementsUpdater.h ('k') | Source/core/layout/compositing/CompositingState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698