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 b7ed656d74a80e1f7942872ad72f305004e7f4b1..3a45d32f557d11809bd9ac9b1efce44f08174e3f 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
@@ -173,6 +173,27 @@ static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer) { |
return (!page) ? nullptr : page->scrollingCoordinator(); |
} |
+static WebLayer* nearestCompositedStickyLayer( |
+ const StickyConstraintsMap& constraintsMap, |
+ LayoutBoxModelObject* obj) { |
+ while (obj && !obj->layer()->compositedLayerMapping()) { |
+ DCHECK(constraintsMap.contains(obj->layer())); |
+ const StickyPositionScrollingConstraints constraints = |
+ constraintsMap.at(obj->layer()); |
+ obj = constraints.nearestStickyBoxShiftingStickyBox() |
+ ? constraints.nearestStickyBoxShiftingStickyBox() |
+ : constraints.nearestStickyBoxShiftingContainingBlock(); |
+ } |
+ |
+ if (!obj) |
+ return nullptr; |
+ |
+ return obj->layer() |
+ ->compositedLayerMapping() |
+ ->mainGraphicsLayer() |
+ ->platformLayer(); |
+} |
+ |
CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) |
: m_owningLayer(layer), |
m_contentOffsetInCompositingLayerDirty(false), |
@@ -308,9 +329,10 @@ void CompositedLayerMapping::updateStickyConstraints( |
WebLayerStickyPositionConstraint webConstraint; |
if (sticky) { |
+ const StickyConstraintsMap& constraintsMap = |
+ ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap(); |
const StickyPositionScrollingConstraints& constraints = |
- ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().at( |
- &m_owningLayer); |
+ constraintsMap.at(&m_owningLayer); |
// Find the layout offset of the unshifted sticky box within its |
// compositingContainer. If the enclosing layer is not the scroller, then |
@@ -353,7 +375,13 @@ void CompositedLayerMapping::updateStickyConstraints( |
enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect()); |
webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect( |
constraints.scrollContainerRelativeContainingBlockRect()); |
- // TODO(smcgruer): Copy fields for nested sticky in cc (crbug.com/672710) |
+ webConstraint.nearestLayerShiftingStickyBox = nearestCompositedStickyLayer( |
+ constraintsMap, constraints.nearestStickyBoxShiftingStickyBox()); |
+ webConstraint.nearestLayerShiftingContainingBlock = |
+ nearestCompositedStickyLayer( |
+ constraintsMap, |
+ constraints.nearestStickyBoxShiftingContainingBlock()); |
+ webConstraint.localStickyOffset = constraints.getLocalStickyOffset(); |
} |
m_graphicsLayer->setStickyPositionConstraint(webConstraint); |