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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp

Issue 2706673002: Mark elements as viewport constrained when they become sticky positioned (Closed)
Patch Set: Add LayoutTest Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
index 92b93ede5558f7ae7b2706123227a683fa50e9b6..673b4e6b45ff70fac5e0b59f1ea56e9e409dbcf0 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -102,24 +102,31 @@ void CompositingInputsUpdater::updateRecursive(PaintLayer* layer,
layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer);
if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() &&
layer->layoutObject()->style()->position() == EPosition::kSticky) {
- if (info.lastOverflowClipLayer != previousOverflowLayer &&
- !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
- // Old ancestor scroller should no longer have these constraints.
- ASSERT(!previousOverflowLayer ||
- !previousOverflowLayer->getScrollableArea()
- ->stickyConstraintsMap()
- .contains(layer));
-
- if (info.lastOverflowClipLayer->isRootLayer())
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ if (info.lastOverflowClipLayer != previousOverflowLayer) {
+ // Old ancestor scroller should no longer have these constraints.
+ DCHECK(!previousOverflowLayer ||
+ !previousOverflowLayer->getScrollableArea()
+ ->stickyConstraintsMap()
+ .contains(layer));
+
+ // If our old ancestor scroller was the root layer, we may not be
+ // viewport constrained anymore. This might be re-added below if the new
flackr 2017/02/22 14:45:42 I don't think the case in this comment can happen.
smcgruer 2017/02/22 15:26:32 Done.
+ // ancestor scroller is also the root layer.
+ if (previousOverflowLayer && previousOverflowLayer->isRootLayer()) {
+ layer->layoutObject()
+ ->view()
+ ->frameView()
+ ->removeViewportConstrainedObject(layer->layoutObject());
+ }
+ }
+
+ if (info.lastOverflowClipLayer->isRootLayer()) {
layer->layoutObject()
->view()
->frameView()
->addViewportConstrainedObject(layer->layoutObject());
- else if (previousOverflowLayer && previousOverflowLayer->isRootLayer())
- layer->layoutObject()
- ->view()
- ->frameView()
- ->removeViewportConstrainedObject(layer->layoutObject());
+ }
}
layer->layoutObject()->updateStickyPositionConstraints();

Powered by Google App Engine
This is Rietveld 408576698