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

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

Issue 2698843004: Correct for enclosing layers scroll position in sticky_data->main_thread_offset (Closed)
Patch Set: Address reviewer comments 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/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index cb2b7ed3227dc3d06d6377d2d01149bba06a465f..dd4da51ec886ddd81f925d987bc92a2790eae0f9 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -308,11 +308,20 @@ void CompositedLayerMapping::updateStickyConstraints(
&m_owningLayer);
// Find the layout offset of the unshifted sticky box within its enclosing
- // layer.
+ // layer. If the enclosing layer is not the scroller, the offset must be
+ // adjusted to include the scroll offset to keep it relative.
+ PaintLayer* enclosingLayer =
+ m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf);
LayoutPoint enclosingLayerOffset;
- m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
- ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
- enclosingLayerOffset);
+ enclosingLayer->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
+ enclosingLayerOffset);
+ if (enclosingLayer != m_owningLayer.ancestorOverflowLayer() &&
+ enclosingLayer->containingLayer()) {
flackr 2017/02/22 15:45:18 Why the check for containingLayer? If it's not the
smcgruer 2017/02/22 15:58:23 Ah, yes, no longer needed.
+ enclosingLayerOffset += LayoutSize(enclosingLayer->ancestorOverflowLayer()
+ ->getScrollableArea()
+ ->getScrollOffset());
+ }
+
FloatPoint stickyBoxOffset =
constraints.scrollContainerRelativeStickyBoxRect().location();
DCHECK(!m_contentOffsetInCompositingLayerDirty);

Powered by Google App Engine
This is Rietveld 408576698