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

Unified 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: Merge with master and add comments to WebLayerStickyPositionConstraint members. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
index c8197c8353e627a584fd8af881a5ea51f70a8aaf..51777eb381099c656b3338a2eac962f1aff9c8df 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
@@ -148,8 +148,9 @@ CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(cons
directReasons |= CompositingReasonOverflowScrollingParent;
}
- if (requiresCompositingForPositionFixed(layer))
- directReasons |= CompositingReasonPositionFixed;
+ // TODO(flackr): Rename functions and variables to include sticky position (i.e. ScrollDependentPosition rather than PositionFixed).
+ if (requiresCompositingForScrollDependentPosition(layer))
+ directReasons |= CompositingReasonScrollDependentPosition;
directReasons |= layoutObject->additionalCompositingReasons();
@@ -165,13 +166,15 @@ bool CompositingReasonFinder::requiresCompositingForAnimation(const ComputedStyl
return style.shouldCompositeForCurrentAnimations();
}
-bool CompositingReasonFinder::requiresCompositingForPositionFixed(const PaintLayer* layer) const
+bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition(const PaintLayer* layer) const
{
if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger))
return false;
// Don't promote fixed position elements that are descendants of a non-view container, e.g. transformed elements.
// They will stay fixed wrt the container rather than the enclosing frame.
- return layer->scrollsWithViewport() && m_layoutView.frameView()->isScrollable();
+ if (layer->scrollsWithViewport())
+ return m_layoutView.frameView()->isScrollable();
+ return layer->layoutObject()->style()->position() == StickyPosition && layer->ancestorOverflowLayer()->scrollsOverflow();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698