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 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 bool CompositingReasonFinder::isMainFrame() const | 42 bool CompositingReasonFinder::isMainFrame() const |
43 { | 43 { |
44 // FIXME: LocalFrame::isMainFrame() is probably better. | 44 // FIXME: LocalFrame::isMainFrame() is probably better. |
45 return !m_layoutView.document().ownerElement(); | 45 return !m_layoutView.document().ownerElement(); |
46 } | 46 } |
47 | 47 |
48 CompositingReasons CompositingReasonFinder::directReasons(const DeprecatedPaintL
ayer* layer) const | 48 CompositingReasons CompositingReasonFinder::directReasons(const DeprecatedPaintL
ayer* layer) const |
49 { | 49 { |
50 if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) | 50 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
51 return CompositingReasonNone; | 51 return CompositingReasonNone; |
52 | 52 |
53 ASSERT(potentialCompositingReasonsFromStyle(layer->layoutObject()) == layer-
>potentialCompositingReasonsFromStyle()); | 53 ASSERT(potentialCompositingReasonsFromStyle(layer->layoutObject()) == layer-
>potentialCompositingReasonsFromStyle()); |
54 CompositingReasons styleDeterminedDirectCompositingReasons = layer->potentia
lCompositingReasonsFromStyle() & CompositingReasonComboAllDirectStyleDeterminedR
easons; | 54 CompositingReasons styleDeterminedDirectCompositingReasons = layer->potentia
lCompositingReasonsFromStyle() & CompositingReasonComboAllDirectStyleDeterminedR
easons; |
55 | 55 |
56 // Apply optimizations for scroll-blocks-on which require comparing style be
tween objects. | 56 // Apply optimizations for scroll-blocks-on which require comparing style be
tween objects. |
57 if ((styleDeterminedDirectCompositingReasons & CompositingReasonScrollBlocks
On) && !requiresCompositingForScrollBlocksOn(layer->layoutObject())) | 57 if ((styleDeterminedDirectCompositingReasons & CompositingReasonScrollBlocks
On) && !requiresCompositingForScrollBlocksOn(layer->layoutObject())) |
58 styleDeterminedDirectCompositingReasons &= ~CompositingReasonScrollBlock
sOn; | 58 styleDeterminedDirectCompositingReasons &= ~CompositingReasonScrollBlock
sOn; |
59 | 59 |
60 return styleDeterminedDirectCompositingReasons | nonStyleDeterminedDirectRea
sons(layer); | 60 return styleDeterminedDirectCompositingReasons | nonStyleDeterminedDirectRea
sons(layer); |
61 } | 61 } |
62 | 62 |
63 // This information doesn't appear to be incorporated into CompositingReasons. | 63 // This information doesn't appear to be incorporated into CompositingReasons. |
64 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const | 64 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const |
65 { | 65 { |
66 // Need this done first to determine overflow. | 66 // Need this done first to determine overflow. |
67 ASSERT(!m_layoutView.needsLayout()); | 67 ASSERT(!m_layoutView.needsLayout()); |
68 if (isMainFrame()) | 68 if (isMainFrame()) |
69 return false; | 69 return false; |
70 | 70 |
71 if (!(m_compositingTriggers & ScrollableInnerFrameTrigger)) | 71 if (!(m_compositingTriggers & ScrollableInnerFrameTrigger)) |
72 return false; | 72 return false; |
73 | 73 |
74 return m_layoutView.frameView()->isScrollable(); | 74 return m_layoutView.frameView()->isScrollable(); |
75 } | 75 } |
76 | 76 |
77 CompositingReasons CompositingReasonFinder::potentialCompositingReasonsFromStyle
(LayoutObject* layoutObject) const | 77 CompositingReasons CompositingReasonFinder::potentialCompositingReasonsFromStyle
(LayoutObject* layoutObject) const |
78 { | 78 { |
79 if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) | 79 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
80 return CompositingReasonNone; | 80 return CompositingReasonNone; |
81 | 81 |
82 CompositingReasons reasons = CompositingReasonNone; | 82 CompositingReasons reasons = CompositingReasonNone; |
83 | 83 |
84 const ComputedStyle& style = layoutObject->styleRef(); | 84 const ComputedStyle& style = layoutObject->styleRef(); |
85 | 85 |
86 if (requiresCompositingForTransform(layoutObject)) | 86 if (requiresCompositingForTransform(layoutObject)) |
87 reasons |= CompositingReason3DTransform; | 87 reasons |= CompositingReason3DTransform; |
88 | 88 |
89 if (style.backfaceVisibility() == BackfaceVisibilityHidden) | 89 if (style.backfaceVisibility() == BackfaceVisibilityHidden) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Either way, we don't need to require compositing for scroll block
s on. This avoids | 230 // Either way, we don't need to require compositing for scroll block
s on. This avoids |
231 // enabling compositing by default, and avoids cluttering the root l
ayers compositing reasons. | 231 // enabling compositing by default, and avoids cluttering the root l
ayers compositing reasons. |
232 return false; | 232 return false; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 return true; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 } | 239 } |
OLD | NEW |