Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/core/layout/compositing/CompositingReasonFinder.cpp

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ASSERT(!m_renderView.needsLayout()); 67 ASSERT(!m_renderView.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_renderView.frameView()->isScrollable(); 74 return m_renderView.frameView()->isScrollable();
75 } 75 }
76 76
77 CompositingReasons CompositingReasonFinder::potentialCompositingReasonsFromStyle (RenderObject* renderer) const 77 CompositingReasons CompositingReasonFinder::potentialCompositingReasonsFromStyle (LayoutObject* renderer) const
78 { 78 {
79 if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled()) 79 if (RuntimeEnabledFeatures::slimmingPaintCompositorLayerizationEnabled())
80 return CompositingReasonNone; 80 return CompositingReasonNone;
81 81
82 CompositingReasons reasons = CompositingReasonNone; 82 CompositingReasons reasons = CompositingReasonNone;
83 83
84 RenderStyle* style = renderer->style(); 84 RenderStyle* style = renderer->style();
85 85
86 if (requiresCompositingForTransform(renderer)) 86 if (requiresCompositingForTransform(renderer))
87 reasons |= CompositingReason3DTransform; 87 reasons |= CompositingReason3DTransform;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (style->hasBlendMode()) 129 if (style->hasBlendMode())
130 reasons |= CompositingReasonBlendingWithCompositedDescendants; 130 reasons |= CompositingReasonBlendingWithCompositedDescendants;
131 131
132 if (renderer->hasReflection()) 132 if (renderer->hasReflection())
133 reasons |= CompositingReasonReflectionWithCompositedDescendants; 133 reasons |= CompositingReasonReflectionWithCompositedDescendants;
134 134
135 ASSERT(!(reasons & ~CompositingReasonComboAllStyleDeterminedReasons)); 135 ASSERT(!(reasons & ~CompositingReasonComboAllStyleDeterminedReasons));
136 return reasons; 136 return reasons;
137 } 137 }
138 138
139 bool CompositingReasonFinder::requiresCompositingForTransform(RenderObject* rend erer) const 139 bool CompositingReasonFinder::requiresCompositingForTransform(LayoutObject* rend erer) const
140 { 140 {
141 // Note that we ask the renderer if it has a transform, because the style ma y have transforms, 141 // Note that we ask the renderer if it has a transform, because the style ma y have transforms,
142 // but the renderer may be an inline that doesn't support them. 142 // but the renderer may be an inline that doesn't support them.
143 return renderer->hasTransformRelatedProperty() && renderer->style()->transfo rm().has3DOperation(); 143 return renderer->hasTransformRelatedProperty() && renderer->style()->transfo rm().has3DOperation();
144 } 144 }
145 145
146 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons t Layer* layer) const 146 CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons t Layer* layer) const
147 { 147 {
148 CompositingReasons directReasons = CompositingReasonNone; 148 CompositingReasons directReasons = CompositingReasonNone;
149 RenderObject* renderer = layer->renderer(); 149 LayoutObject* renderer = layer->renderer();
150 150
151 if (hasOverflowScrollTrigger()) { 151 if (hasOverflowScrollTrigger()) {
152 if (layer->clipParent()) 152 if (layer->clipParent())
153 directReasons |= CompositingReasonOutOfFlowClipping; 153 directReasons |= CompositingReasonOutOfFlowClipping;
154 154
155 if (const Layer* scrollingAncestor = layer->ancestorScrollingLayer()) { 155 if (const Layer* scrollingAncestor = layer->ancestorScrollingLayer()) {
156 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollPa rent()) 156 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollPa rent())
157 directReasons |= CompositingReasonOverflowScrollingParent; 157 directReasons |= CompositingReasonOverflowScrollingParent;
158 } 158 }
159 159
(...skipping 20 matching lines...) Expand all
180 180
181 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Layer* l ayer) const 181 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Layer* l ayer) const
182 { 182 {
183 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) 183 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger))
184 return false; 184 return false;
185 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 185 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
186 // They will stay fixed wrt the container rather than the enclosing frame. 186 // They will stay fixed wrt the container rather than the enclosing frame.
187 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl e(); 187 return layer->scrollsWithViewport() && m_renderView.frameView()->isScrollabl e();
188 } 188 }
189 189
190 bool CompositingReasonFinder::requiresCompositingForScrollBlocksOn(const RenderO bject* renderer) const 190 bool CompositingReasonFinder::requiresCompositingForScrollBlocksOn(const LayoutO bject* renderer) const
191 { 191 {
192 // Note that the other requires* functions run at RenderObject::styleDidChan ge time and so can rely 192 // Note that the other requires* functions run at LayoutObject::styleDidChan ge time and so can rely
193 // only on the style of their object. This function runs at CompositingRequ irementsUpdater::update 193 // only on the style of their object. This function runs at CompositingRequ irementsUpdater::update
194 // time, and so can consider the style of other objects. 194 // time, and so can consider the style of other objects.
195 RenderStyle* style = renderer->style(); 195 RenderStyle* style = renderer->style();
196 196
197 // We should only get here by CompositingReasonScrollBlocksOn being a potent ial compositing reason. 197 // We should only get here by CompositingReasonScrollBlocksOn being a potent ial compositing reason.
198 ASSERT(style->hasScrollBlocksOn() && !renderer->isDocumentElement()); 198 ASSERT(style->hasScrollBlocksOn() && !renderer->isDocumentElement());
199 199
200 // scroll-blocks-on style is propagated from the document element to the doc ument. 200 // scroll-blocks-on style is propagated from the document element to the doc ument.
201 ASSERT(!renderer->isRenderView() 201 ASSERT(!renderer->isRenderView()
202 || !renderer->document().documentElement() 202 || !renderer->document().documentElement()
(...skipping 21 matching lines...) Expand all
224 // Either way, we don't need to require compositing for scroll block s on. This avoids 224 // Either way, we don't need to require compositing for scroll block s on. This avoids
225 // enabling compositing by default, and avoids cluttering the root l ayers compositing reasons. 225 // enabling compositing by default, and avoids cluttering the root l ayers compositing reasons.
226 return false; 226 return false;
227 } 227 }
228 } 228 }
229 229
230 return true; 230 return true;
231 } 231 }
232 232
233 } 233 }
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositingReasonFinder.h ('k') | Source/core/layout/compositing/LayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698