| 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/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 { | 42 { |
| 43 m_compositingTriggers = 0; | 43 m_compositingTriggers = 0; |
| 44 | 44 |
| 45 Settings& settings = m_renderView.document().page()->settings(); | 45 Settings& settings = m_renderView.document().page()->settings(); |
| 46 if (settings.acceleratedCompositingForVideoEnabled()) | 46 if (settings.acceleratedCompositingForVideoEnabled()) |
| 47 m_compositingTriggers |= VideoTrigger; | 47 m_compositingTriggers |= VideoTrigger; |
| 48 if (settings.acceleratedCompositingForPluginsEnabled()) | 48 if (settings.acceleratedCompositingForPluginsEnabled()) |
| 49 m_compositingTriggers |= PluginTrigger; | 49 m_compositingTriggers |= PluginTrigger; |
| 50 if (settings.acceleratedCompositingForCanvasEnabled()) | 50 if (settings.acceleratedCompositingForCanvasEnabled()) |
| 51 m_compositingTriggers |= CanvasTrigger; | 51 m_compositingTriggers |= CanvasTrigger; |
| 52 if (settings.acceleratedCompositingForAnimationEnabled()) | |
| 53 m_compositingTriggers |= AnimationTrigger; | |
| 54 if (settings.compositedScrollingForFramesEnabled()) | 52 if (settings.compositedScrollingForFramesEnabled()) |
| 55 m_compositingTriggers |= ScrollableInnerFrameTrigger; | 53 m_compositingTriggers |= ScrollableInnerFrameTrigger; |
| 56 if (settings.acceleratedCompositingForFiltersEnabled()) | 54 if (settings.acceleratedCompositingForFiltersEnabled()) |
| 57 m_compositingTriggers |= FilterTrigger; | 55 m_compositingTriggers |= FilterTrigger; |
| 58 if (settings.acceleratedCompositingForGpuRasterizationHintEnabled()) | 56 if (settings.acceleratedCompositingForGpuRasterizationHintEnabled()) |
| 59 m_compositingTriggers |= GPURasterizationTrigger; | 57 m_compositingTriggers |= GPURasterizationTrigger; |
| 60 | 58 |
| 61 // We map both these settings to universal overlow scrolling. | 59 // We map both these settings to universal overlow scrolling. |
| 62 // FIXME: Replace these settings with a generic compositing setting for High
DPI. | 60 // FIXME: Replace these settings with a generic compositing setting for High
DPI. |
| 63 if (settings.acceleratedCompositingForOverflowScrollEnabled() || settings.co
mpositorDrivenAcceleratedScrollingEnabled()) | 61 if (settings.acceleratedCompositingForOverflowScrollEnabled() || settings.co
mpositorDrivenAcceleratedScrollingEnabled()) |
| 64 m_compositingTriggers |= OverflowScrollTrigger; | 62 m_compositingTriggers |= OverflowScrollTrigger; |
| 65 | 63 |
| 66 // FIXME: acceleratedCompositingForFixedPositionEnabled should be renamed ac
celeratedCompositingForViewportConstrainedPositionEnabled(). | 64 // FIXME: acceleratedCompositingForFixedPositionEnabled should be renamed ac
celeratedCompositingForViewportConstrainedPositionEnabled(). |
| 67 // Or the sticky and fixed position elements should be behind different flag
s. | 65 // Or the sticky and fixed position elements should be behind different flag
s. |
| 68 if (settings.acceleratedCompositingForFixedPositionEnabled()) | 66 if (settings.acceleratedCompositingForFixedPositionEnabled()) |
| 69 m_compositingTriggers |= ViewportConstrainedPositionedTrigger; | 67 m_compositingTriggers |= ViewportConstrainedPositionedTrigger; |
| 70 } | 68 } |
| 71 | 69 |
| 72 bool CompositingReasonFinder::hasAnimationTrigger() const | |
| 73 { | |
| 74 return m_compositingTriggers & AnimationTrigger; | |
| 75 } | |
| 76 | |
| 77 bool CompositingReasonFinder::hasOverflowScrollTrigger() const | 70 bool CompositingReasonFinder::hasOverflowScrollTrigger() const |
| 78 { | 71 { |
| 79 return m_compositingTriggers & OverflowScrollTrigger; | 72 return m_compositingTriggers & OverflowScrollTrigger; |
| 80 } | 73 } |
| 81 | 74 |
| 82 // FIXME: This is a temporary trigger for enabling the old, opt-in path for | 75 // FIXME: This is a temporary trigger for enabling the old, opt-in path for |
| 83 // accelerated overflow scroll. It should be removed once the "universal" | 76 // accelerated overflow scroll. It should be removed once the "universal" |
| 84 // path is ready (crbug.com/254111). | 77 // path is ready (crbug.com/254111). |
| 85 bool CompositingReasonFinder::hasLegacyOverflowScrollTrigger() const | 78 bool CompositingReasonFinder::hasLegacyOverflowScrollTrigger() const |
| 86 { | 79 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 directReasons |= CompositingReasonPositionFixed; | 203 directReasons |= CompositingReasonPositionFixed; |
| 211 | 204 |
| 212 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); | 205 directReasons |= renderer->additionalCompositingReasons(m_compositingTrigger
s); |
| 213 | 206 |
| 214 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); | 207 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); |
| 215 return directReasons; | 208 return directReasons; |
| 216 } | 209 } |
| 217 | 210 |
| 218 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const | 211 bool CompositingReasonFinder::requiresCompositingForAnimation(RenderObject* rend
erer) const |
| 219 { | 212 { |
| 220 if (!(m_compositingTriggers & AnimationTrigger)) | |
| 221 return false; | |
| 222 | |
| 223 return renderer->style()->shouldCompositeForCurrentAnimations(); | 213 return renderer->style()->shouldCompositeForCurrentAnimations(); |
| 224 } | 214 } |
| 225 | 215 |
| 226 bool CompositingReasonFinder::requiresCompositingForOutOfFlowClipping(const Rend
erLayer* layer) const | 216 bool CompositingReasonFinder::requiresCompositingForOutOfFlowClipping(const Rend
erLayer* layer) const |
| 227 { | 217 { |
| 228 return layer->isUnclippedDescendant(); | 218 return layer->isUnclippedDescendant(); |
| 229 } | 219 } |
| 230 | 220 |
| 231 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const | 221 bool CompositingReasonFinder::requiresCompositingForOverflowScrollingParent(cons
t RenderLayer* layer) const |
| 232 { | 222 { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 *needToRecomputeCompositingRequirements = true; | 342 *needToRecomputeCompositingRequirements = true; |
| 353 } | 343 } |
| 354 return false; | 344 return false; |
| 355 } | 345 } |
| 356 } | 346 } |
| 357 | 347 |
| 358 return true; | 348 return true; |
| 359 } | 349 } |
| 360 | 350 |
| 361 } | 351 } |
| OLD | NEW |