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 60bc7d9c1f0b10387e35cea5af6102cff05cc949..c9f095cb58305cc9f965ca47a6da1a8f1750a032 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp |
| @@ -311,11 +311,19 @@ 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()) { |
| + enclosingLayerOffset += LayoutSize(enclosingLayer->ancestorOverflowLayer() |
|
flackr
2017/02/22 20:44:00
nit: use ancestorOverflowLayer (from line 296) her
smcgruer
2017/02/22 20:48:18
Done.
|
| + ->getScrollableArea() |
| + ->getScrollOffset()); |
| + } |
| + |
| FloatPoint stickyBoxOffset = |
| constraints.scrollContainerRelativeStickyBoxRect().location(); |
| DCHECK(!m_contentOffsetInCompositingLayerDirty); |