| 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 "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 void CompositingReasonFinder::updateTriggers() | 25 void CompositingReasonFinder::updateTriggers() |
| 26 { | 26 { |
| 27 m_compositingTriggers = 0; | 27 m_compositingTriggers = 0; |
| 28 | 28 |
| 29 Settings& settings = m_renderView.document().page()->settings(); | 29 Settings& settings = m_renderView.document().page()->settings(); |
| 30 if (settings.preferCompositingToLCDTextEnabled()) { | 30 if (settings.preferCompositingToLCDTextEnabled()) { |
| 31 m_compositingTriggers |= ScrollableInnerFrameTrigger; | 31 m_compositingTriggers |= ScrollableInnerFrameTrigger; |
| 32 m_compositingTriggers |= OverflowScrollTrigger; | 32 m_compositingTriggers |= OverflowScrollTrigger; |
| 33 m_compositingTriggers |= ViewportConstrainedPositionedTrigger; | |
| 34 } | 33 } |
| 35 } | 34 } |
| 36 | 35 |
| 37 bool CompositingReasonFinder::hasOverflowScrollTrigger() const | 36 bool CompositingReasonFinder::hasOverflowScrollTrigger() const |
| 38 { | 37 { |
| 39 return m_compositingTriggers & OverflowScrollTrigger; | 38 return m_compositingTriggers & OverflowScrollTrigger; |
| 40 } | 39 } |
| 41 | 40 |
| 42 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er) const | 41 CompositingReasons CompositingReasonFinder::directReasons(const RenderLayer* lay
er) const |
| 43 { | 42 { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 120 |
| 122 if (const RenderLayer* scrollingAncestor = layer->ancestorScrollingLayer
()) { | 121 if (const RenderLayer* scrollingAncestor = layer->ancestorScrollingLayer
()) { |
| 123 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollPa
rent()) | 122 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollPa
rent()) |
| 124 directReasons |= CompositingReasonOverflowScrollingParent; | 123 directReasons |= CompositingReasonOverflowScrollingParent; |
| 125 } | 124 } |
| 126 | 125 |
| 127 if (layer->needsCompositedScrolling()) | 126 if (layer->needsCompositedScrolling()) |
| 128 directReasons |= CompositingReasonOverflowScrollingTouch; | 127 directReasons |= CompositingReasonOverflowScrollingTouch; |
| 129 } | 128 } |
| 130 | 129 |
| 131 if (requiresCompositingForPositionFixed(layer)) | |
| 132 directReasons |= CompositingReasonPositionFixed; | |
| 133 | |
| 134 directReasons |= renderer->additionalCompositingReasons(); | 130 directReasons |= renderer->additionalCompositingReasons(); |
| 135 | 131 |
| 136 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 132 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
| 137 return directReasons; | 133 return directReasons; |
| 138 } | 134 } |
| 139 | 135 |
| 140 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const | 136 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderStyle* style
) const |
| 141 { | 137 { |
| 142 if (style->subtreeWillChangeContents()) | 138 if (style->subtreeWillChangeContents()) |
| 143 return style->isRunningAnimationOnCompositor(); | 139 return style->isRunningAnimationOnCompositor(); |
| 144 | 140 |
| 145 return style->shouldCompositeForCurrentAnimations(); | 141 return style->shouldCompositeForCurrentAnimations(); |
| 146 } | 142 } |
| 147 | 143 |
| 148 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const RenderLa
yer* layer) const | |
| 149 { | |
| 150 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | |
| 151 return false; | |
| 152 // Don't promote fixed position elements that are descendants of a non-view
container, e.g. transformed elements. | |
| 153 // They will stay fixed wrt the container rather than the enclosing frame. | |
| 154 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl
e(); | |
| 155 } | 144 } |
| 156 | |
| 157 } | |
| OLD | NEW |