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

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

Issue 2251303003: Implement position: sticky updates on compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and add unit test for impl side sticky position update. Created 4 years, 3 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
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 "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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 // Composite |layer| if it is inside of an ancestor scrolling layer, but tha t 153 // Composite |layer| if it is inside of an ancestor scrolling layer, but tha t
154 // scrolling layer is not not on the stacking context ancestor chain of |lay er|. 154 // scrolling layer is not not on the stacking context ancestor chain of |lay er|.
155 // See the definition of the scrollParent property in Layer for more detail. 155 // See the definition of the scrollParent property in Layer for more detail.
156 if (const PaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) { 156 if (const PaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) {
157 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent ()) 157 if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent ())
158 directReasons |= CompositingReasonOverflowScrollingParent; 158 directReasons |= CompositingReasonOverflowScrollingParent;
159 } 159 }
160 160
161 if (requiresCompositingForPositionFixed(layer)) 161 // TODO(flackr): Rename functions and variables to include sticky position ( i.e. ScrollDependentPosition rather than PositionFixed).
162 directReasons |= CompositingReasonPositionFixed; 162 if (requiresCompositingForScrollDependentPosition(layer))
163 directReasons |= CompositingReasonScrollDependentPosition;
163 164
164 directReasons |= layoutObject->additionalCompositingReasons(); 165 directReasons |= layoutObject->additionalCompositingReasons();
165 166
166 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons)); 167 ASSERT(!(directReasons & CompositingReasonComboAllStyleDeterminedReasons));
167 return directReasons; 168 return directReasons;
168 } 169 }
169 170
170 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const 171 bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl e& style) const
171 { 172 {
172 if (style.subtreeWillChangeContents()) 173 if (style.subtreeWillChangeContents())
173 return style.isRunningAnimationOnCompositor(); 174 return style.isRunningAnimationOnCompositor();
174 175
175 return style.shouldCompositeForCurrentAnimations(); 176 return style.shouldCompositeForCurrentAnimations();
176 } 177 }
177 178
178 bool CompositingReasonFinder::requiresCompositingForPositionFixed(const PaintLay er* layer) const 179 bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition(cons t PaintLayer* layer) const
179 { 180 {
180 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger)) 181 if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger))
181 return false; 182 return false;
182 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements. 183 // Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
183 // They will stay fixed wrt the container rather than the enclosing frame. 184 // They will stay fixed wrt the container rather than the enclosing frame.
184 return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollabl e(); 185 if (layer->scrollsWithViewport())
186 return m_layoutView.frameView()->isScrollable();
187 return layer->layoutObject()->style()->position() == StickyPosition && layer ->ancestorOverflowLayer()->scrollsOverflow();
185 } 188 }
186 189
187 } // namespace blink 190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698