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

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

Issue 1287623002: Delete blink code for scroll-blocks-on (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge with trunk (no changes from previous patch) Created 5 years, 4 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::slimmingPaintV2Enabled()) 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.
57 if ((styleDeterminedDirectCompositingReasons & CompositingReasonScrollBlocks On) && !requiresCompositingForScrollBlocksOn(layer->layoutObject()))
58 styleDeterminedDirectCompositingReasons &= ~CompositingReasonScrollBlock sOn;
59
60 return styleDeterminedDirectCompositingReasons | nonStyleDeterminedDirectRea sons(layer); 56 return styleDeterminedDirectCompositingReasons | nonStyleDeterminedDirectRea sons(layer);
61 } 57 }
62 58
63 // This information doesn't appear to be incorporated into CompositingReasons. 59 // This information doesn't appear to be incorporated into CompositingReasons.
64 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const 60 bool CompositingReasonFinder::requiresCompositingForScrollableFrame() const
65 { 61 {
66 // Need this done first to determine overflow. 62 // Need this done first to determine overflow.
67 ASSERT(!m_layoutView.needsLayout()); 63 ASSERT(!m_layoutView.needsLayout());
68 if (isMainFrame()) 64 if (isMainFrame())
69 return false; 65 return false;
(...skipping 27 matching lines...) Expand all
97 93
98 if (style.hasInlineTransform()) 94 if (style.hasInlineTransform())
99 reasons |= CompositingReasonInlineTransform; 95 reasons |= CompositingReasonInlineTransform;
100 96
101 if (style.transformStyle3D() == TransformStyle3DPreserve3D) 97 if (style.transformStyle3D() == TransformStyle3DPreserve3D)
102 reasons |= CompositingReasonPreserve3DWith3DDescendants; 98 reasons |= CompositingReasonPreserve3DWith3DDescendants;
103 99
104 if (style.hasPerspective()) 100 if (style.hasPerspective())
105 reasons |= CompositingReasonPerspectiveWith3DDescendants; 101 reasons |= CompositingReasonPerspectiveWith3DDescendants;
106 102
107 // Ignore scroll-blocks-on on the document element, because it will get prop agated to
108 // the LayoutView (by Document::inheritHtmlAndBodyElementStyles) and we don' t want to
109 // create two composited layers.
110 if (style.hasScrollBlocksOn() && !layoutObject->isDocumentElement())
111 reasons |= CompositingReasonScrollBlocksOn;
112
113 if (style.hasCompositorProxy()) 103 if (style.hasCompositorProxy())
114 reasons |= CompositingReasonCompositorProxy; 104 reasons |= CompositingReasonCompositorProxy;
115 105
116 // If the implementation of createsGroup changes, we need to be aware of tha t in this part of code. 106 // If the implementation of createsGroup changes, we need to be aware of tha t in this part of code.
117 ASSERT((layoutObject->isTransparent() || layoutObject->hasMask() || layoutOb ject->hasFilter() || style.hasBlendMode()) == layoutObject->createsGroup()); 107 ASSERT((layoutObject->isTransparent() || layoutObject->hasMask() || layoutOb ject->hasFilter() || style.hasBlendMode()) == layoutObject->createsGroup());
118 108
119 if (style.hasMask()) 109 if (style.hasMask())
120 reasons |= CompositingReasonMaskWithCompositedDescendants; 110 reasons |= CompositingReasonMaskWithCompositedDescendants;
121 111
122 if (style.hasFilter()) 112 if (style.hasFilter())
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 176
187 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat edPaintLayer* layer) const 177 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const Deprecat edPaintLayer* layer) const
188 { 178 {
189 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) 179 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger))
190 return false; 180 return false;
191 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 181 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
192 // They will stay fixed wrt the container rather than the enclosing frame. 182 // They will stay fixed wrt the container rather than the enclosing frame.
193 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl e(); 183 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl e();
194 } 184 }
195 185
196 bool CompositingReasonFinder::requiresCompositingForScrollBlocksOn(const LayoutO bject* layoutObject) const
197 {
198 // Note that the other requires* functions run at LayoutObject::styleDidChan ge time and so can rely
199 // only on the style of their object. This function runs at CompositingRequ irementsUpdater::update
200 // time, and so can consider the style of other objects.
201 const ComputedStyle& style = layoutObject->styleRef();
202
203 // We should only get here by CompositingReasonScrollBlocksOn being a potent ial compositing reason.
204 ASSERT(style.hasScrollBlocksOn() && !layoutObject->isDocumentElement());
205
206 // scroll-blocks-on style is propagated from the document element to the doc ument.
207 ASSERT(!layoutObject->isLayoutView()
208 || !layoutObject->document().documentElement()
209 || !layoutObject->document().documentElement()->layoutObject()
210 || layoutObject->document().documentElement()->layoutObject()->style()-> scrollBlocksOn() == style.scrollBlocksOn());
211
212 // When a scroll occurs, it's the union of all bits set on the target elemen t's containing block
213 // chain that determines the behavior. Thus we really only need a new layer if this object contains
214 // additional bits from those set by all objects in it's containing block ch ain. But determining
215 // this fully is probably more expensive than it's worth. Instead we just h ave fast-paths here for
216 // the most common cases of unnecessary layer creation.
217 // Optimizing this fully would avoid layer explosion in pathological cases l ike '*' rules.
218 // We could consider tracking the current state in CompositingRequirementsUp dater::update.
219
220 // Ensure iframes don't get composited when they require no more blocking th an their parent.
221 if (layoutObject->isLayoutView()) {
222 if (const FrameView* parentFrame = toLayoutView(layoutObject)->frameView ()->parentFrameView()) {
223 if (const LayoutView* parentLayoutObject = parentFrame->layoutView() ) {
224 // Does this frame contain only blocks-on bits already present i n the parent frame?
225 if (!(style.scrollBlocksOn() & ~parentLayoutObject->style()->scr ollBlocksOn()))
226 return false;
227 }
228 } else {
229 // The root frame will either always already be composited, or compo siting will be disabled.
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.
232 return false;
233 }
234 }
235
236 return true;
237 } 186 }
238
239 }
OLDNEW
« no previous file with comments | « Source/core/layout/compositing/CompositingReasonFinder.h ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698