OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/rendering/compositing/CompositingReasonFinder.h" | 6 #include "core/rendering/compositing/CompositingReasonFinder.h" |
7 | 7 |
8 #include "CSSPropertyNames.h" | 8 #include "CSSPropertyNames.h" |
9 #include "HTMLNames.h" | 9 #include "HTMLNames.h" |
10 #include "core/animation/ActiveAnimations.h" | 10 #include "core/animation/ActiveAnimations.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 if (requiresCompositingForOverflowScrolling(layer)) | 95 if (requiresCompositingForOverflowScrolling(layer)) |
96 directReasons |= CompositingReasonOverflowScrollingTouch; | 96 directReasons |= CompositingReasonOverflowScrollingTouch; |
97 | 97 |
98 if (requiresCompositingForOverflowScrollingParent(layer)) | 98 if (requiresCompositingForOverflowScrollingParent(layer)) |
99 directReasons |= CompositingReasonOverflowScrollingParent; | 99 directReasons |= CompositingReasonOverflowScrollingParent; |
100 | 100 |
101 if (requiresCompositingForOutOfFlowClipping(layer)) | 101 if (requiresCompositingForOutOfFlowClipping(layer)) |
102 directReasons |= CompositingReasonOutOfFlowClipping; | 102 directReasons |= CompositingReasonOutOfFlowClipping; |
103 | 103 |
| 104 if (requiresCompositingForWillChange(renderer)) |
| 105 directReasons |= CompositingReasonWillChange; |
| 106 |
104 return directReasons; | 107 return directReasons; |
105 } | 108 } |
106 | 109 |
107 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const | 110 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const |
108 { | 111 { |
109 // Need this done first to determine overflow. | 112 // Need this done first to determine overflow. |
110 ASSERT(!m_renderView.needsLayout()); | 113 ASSERT(!m_renderView.needsLayout()); |
111 if (isMainFrame()) | 114 if (isMainFrame()) |
112 return false; | 115 return false; |
113 | 116 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const | 254 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const |
252 { | 255 { |
253 return !!layer->scrollParent(); | 256 return !!layer->scrollParent(); |
254 } | 257 } |
255 | 258 |
256 bool CompositingReasonFinder::requiresCompositingForOutOfFlowClipping(const Rend
erLayer* layer) const | 259 bool CompositingReasonFinder::requiresCompositingForOutOfFlowClipping(const Rend
erLayer* layer) const |
257 { | 260 { |
258 return m_renderView.compositorDrivenAcceleratedScrollingEnabled() && layer->
isUnclippedDescendant(); | 261 return m_renderView.compositorDrivenAcceleratedScrollingEnabled() && layer->
isUnclippedDescendant(); |
259 } | 262 } |
260 | 263 |
| 264 bool CompositingReasonFinder::requiresCompositingForWillChange(const RenderObjec
t* renderer) const |
| 265 { |
| 266 return renderer->style()->hasWillChangeCompositingHint(); |
| 267 } |
| 268 |
261 bool CompositingReasonFinder::isViewportConstrainedFixedOrStickyLayer(const Rend
erLayer* layer) | 269 bool CompositingReasonFinder::isViewportConstrainedFixedOrStickyLayer(const Rend
erLayer* layer) |
262 { | 270 { |
263 if (layer->renderer()->isStickyPositioned()) | 271 if (layer->renderer()->isStickyPositioned()) |
264 return !layer->enclosingOverflowClipLayer(ExcludeSelf); | 272 return !layer->enclosingOverflowClipLayer(ExcludeSelf); |
265 | 273 |
266 if (layer->renderer()->style()->position() != FixedPosition) | 274 if (layer->renderer()->style()->position() != FixedPosition) |
267 return false; | 275 return false; |
268 | 276 |
269 for (const RenderLayerStackingNode* stackingContainer = layer->stackingNode(
); stackingContainer; | 277 for (const RenderLayerStackingNode* stackingContainer = layer->stackingNode(
); stackingContainer; |
270 stackingContainer = stackingContainer->ancestorStackingContainerNode())
{ | 278 stackingContainer = stackingContainer->ancestorStackingContainerNode())
{ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 384 |
377 return true; | 385 return true; |
378 } | 386 } |
379 | 387 |
380 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const | 388 bool CompositingReasonFinder::requiresCompositingForOverflowScrolling(const Rend
erLayer* layer) const |
381 { | 389 { |
382 return layer->needsCompositedScrolling(); | 390 return layer->needsCompositedScrolling(); |
383 } | 391 } |
384 | 392 |
385 } | 393 } |
OLD | NEW |