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/layout/compositing/CompositingReasonFinder.h" | 6 #include "core/layout/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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const | 172 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const |
173 { | 173 { |
174 if (style.subtreeWillChangeContents()) | 174 if (style.subtreeWillChangeContents()) |
175 return style.isRunningAnimationOnCompositor(); | 175 return style.isRunningAnimationOnCompositor(); |
176 | 176 |
177 return style.shouldCompositeForCurrentAnimations(); | 177 return style.shouldCompositeForCurrentAnimations(); |
178 } | 178 } |
179 | 179 |
180 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat edPaintLayer* layer) const | 180 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat edPaintLayer* layer) const |
181 { | 181 { |
182 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) | |
183 return false; | |
184 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. | 182 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. |
185 // They will stay fixed wrt the container rather than the enclosing frame. | 183 // They will stay fixed wrt the container rather than the enclosing frame. |
186 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl e(); | 184 if (!layer->scrollsWithViewport() || !m_layoutView.frameView()->isScrollable ()) |
185 return false; | |
186 | |
187 if (m_compositingTriggers & ViewportConstrainedPositionedTrigger) | |
188 return true; | |
189 | |
190 // If the layer is opaque we can still promote it since we will not lose LCD text | |
191 LayoutRect bounds = layer->physicalBoundingBox(layer); | |
192 const DeprecatedPaintLayer* currentChild = layer->firstChild(); | |
193 // Include any possible overflow from children | |
194 for (; currentChild; currentChild = currentChild->nextSibling()) { | |
195 LayoutRect childBounds = currentChild->physicalBoundingBox(layer); | |
196 bounds.unite(childBounds); | |
197 } | |
trchen
2015/09/17 21:40:33
A few problem here:
1. This only adds the overflow
Ian Vollick
2015/09/18 02:09:50
Yes, this is indeed too slow. If you look at Depre
davidfox
2015/09/18 02:55:40
Sorry for the "double" post. Initially replied to
| |
198 | |
199 return layer->backgroundIsKnownToBeOpaqueInRect(bounds); | |
187 } | 200 } |
188 | 201 |
189 } | 202 } |
OLD | NEW |