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

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

Issue 2401903002: Compute and include the offset of the sticky box to its enclosing composited layer. (Closed)
Patch Set: Created 4 years, 2 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 f9e9c1e7acdc96ee82cd141590d4d6d39b267ada..ccef006b1f6c036b15470d427d2a0ec196111ebe 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -302,6 +302,16 @@ void CompositedLayerMapping::updateStickyConstraints(
const StickyPositionScrollingConstraints& constraints =
ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get(
&m_owningLayer);
+
+ // Find the layout offset of the unshifted sticky box within its enclosing layer.
+ LayoutPoint enclosingLayerOffset;
+ m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf)
+ ->convertToLayerCoords(m_owningLayer.ancestorOverflowLayer(),
+ enclosingLayerOffset);
+ FloatPoint stickyBoxOffset =
+ constraints.scrollContainerRelativeStickyBoxRect().location();
+ stickyBoxOffset.moveBy(FloatPoint(-enclosingLayerOffset));
+
webConstraint.isSticky = true;
webConstraint.isAnchoredLeft =
constraints.anchorEdges() &
@@ -319,6 +329,8 @@ void CompositedLayerMapping::updateStickyConstraints(
webConstraint.rightOffset = constraints.rightOffset();
webConstraint.topOffset = constraints.topOffset();
webConstraint.bottomOffset = constraints.bottomOffset();
+ webConstraint.parentRelativeStickyBoxOffset =
+ roundedIntPoint(stickyBoxOffset);
webConstraint.scrollContainerRelativeStickyBoxRect =
enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect());
webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect(

Powered by Google App Engine
This is Rietveld 408576698