Chromium Code Reviews| 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..1c084362a92a347c223e779f7eb94dbd8a33e399 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()) { |
| + enclosingLayerOffset += enclosingLayer->containingLayer() |
| + ->layoutBox() |
| + ->scrolledContentOffset(); |
|
flackr
2017/02/22 14:23:09
scrolledContentOffset requires that the box has an
smcgruer
2017/02/22 15:42:30
Done.
|
| + } |
| + |
| FloatPoint stickyBoxOffset = |
| constraints.scrollContainerRelativeStickyBoxRect().location(); |
| DCHECK(!m_contentOffsetInCompositingLayerDirty); |