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

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 nit 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 60bc7d9c1f0b10387e35cea5af6102cff05cc949..39b51de3caff42f42c1d34f568e1b90173a0a65e 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -311,11 +311,18 @@ 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.
chrishtr 2017/02/28 19:36:28 "relative to compositingContainer"
smcgruer 2017/03/01 19:58:39 Done.
+ PaintLayer* enclosingLayer =
+ m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf);
chrishtr 2017/02/28 19:36:28 Please pass compositingContainer to updateStickyCo
smcgruer 2017/03/01 19:58:40 Done.
LayoutPoint enclosingLayerOffset;
- m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
- ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
- enclosingLayerOffset);
+ enclosingLayer->convertToLayerCoords(ancestorOverflowLayer,
+ enclosingLayerOffset);
+ if (enclosingLayer != ancestorOverflowLayer) {
+ enclosingLayerOffset += LayoutSize(
+ ancestorOverflowLayer->getScrollableArea()->getScrollOffset());
+ }
+
FloatPoint stickyBoxOffset =
constraints.scrollContainerRelativeStickyBoxRect().location();
DCHECK(!m_contentOffsetInCompositingLayerDirty);

Powered by Google App Engine
This is Rietveld 408576698