Chromium Code Reviews| 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 "core/layout/compositing/CompositingReasonFinder.h" | 5 #include "core/layout/compositing/CompositingReasonFinder.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const | 161 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const |
| 162 { | 162 { |
| 163 if (style.subtreeWillChangeContents()) | 163 if (style.subtreeWillChangeContents()) |
| 164 return style.isRunningAnimationOnCompositor(); | 164 return style.isRunningAnimationOnCompositor(); |
| 165 | 165 |
| 166 return style.shouldCompositeForCurrentAnimations(); | 166 return style.shouldCompositeForCurrentAnimations(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition(cons t PaintLayer* layer) const | 169 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition(cons t PaintLayer* layer) const |
| 170 { | 170 { |
| 171 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | 171 if (layer->layoutObject()->style()->position() != FixedPosition |
| 172 && layer->layoutObject()->style()->position() != StickyPosition) | |
|
flackr
2016/09/23 18:19:35
This is just an early out to prevent doing the wor
| |
| 172 return false; | 173 return false; |
| 174 | |
| 175 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger) | |
| 176 && (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() | |
| 177 || !layer->backgroundIsKnownToBeOpaqueInRect(LayoutRect(layer->bound ingBoxForCompositing())))) { | |
| 178 return false; | |
| 179 } | |
| 173 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. | 180 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. |
| 174 // They will stay fixed wrt the container rather than the enclosing frame. | 181 // They will stay fixed wrt the container rather than the enclosing frame. |
| 175 if (layer->scrollsWithViewport()) | 182 if (layer->scrollsWithViewport()) |
| 176 return m_layoutView.frameView()->isScrollable(); | 183 return m_layoutView.frameView()->isScrollable(); |
| 177 return layer->layoutObject()->style()->position() == StickyPosition && layer ->ancestorOverflowLayer()->scrollsOverflow(); | 184 return layer->layoutObject()->style()->position() == StickyPosition && layer ->ancestorOverflowLayer()->scrollsOverflow(); |
| 178 } | 185 } |
| 179 | 186 |
| 180 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |