Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
index c96f42c49d496e00d9ca3538e287babc7d8d072d..988740be5f2f14526785999c6bd7ea62ba1eb589 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
@@ -99,7 +99,7 @@ static CompositingQueryMode gCompositingQueryMode = |
struct SameSizeAsPaintLayer : DisplayItemClient { |
int bitFields; |
- void* pointers[9]; |
+ void* pointers[10]; |
LayoutUnit layoutUnits[4]; |
IntSize size; |
OwnPtrWillBePersistent<PaintLayerScrollableArea> scrollableArea; |
@@ -173,6 +173,7 @@ PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject, PaintLayerType type) |
, m_last(0) |
, m_staticInlinePosition(0) |
, m_staticBlockPosition(0) |
+ , m_ancestorOverflowLayer(nullptr) |
{ |
updateStackingNode(); |
@@ -352,7 +353,8 @@ void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() |
bool PaintLayer::scrollsWithViewport() const |
{ |
- return layoutObject()->style()->position() == FixedPosition && layoutObject()->containerForFixedPosition() == layoutObject()->view(); |
+ return (layoutObject()->style()->position() == FixedPosition && layoutObject()->containerForFixedPosition() == layoutObject()->view()) |
+ || (layoutObject()->style()->position() == StickyPosition && !ancestorScrollingLayer()); |
} |
bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const |
@@ -750,7 +752,7 @@ bool PaintLayer::update3DTransformedDescendantStatus() |
return has3DTransform(); |
} |
-bool PaintLayer::updateLayerPosition() |
+void PaintLayer::updateLayerPosition() |
{ |
LayoutPoint localPoint; |
LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done. |
@@ -801,10 +803,8 @@ bool PaintLayer::updateLayerPosition() |
localPoint -= scrollOffset; |
} |
- bool positionOrOffsetChanged = false; |
if (layoutObject()->isInFlowPositioned()) { |
LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); |
- positionOrOffsetChanged = newOffset != offsetForInFlowPosition(); |
if (m_rareData || !newOffset.isZero()) |
ensureRareData().offsetForInFlowPosition = newOffset; |
localPoint.move(newOffset); |
@@ -816,7 +816,6 @@ bool PaintLayer::updateLayerPosition() |
localPoint.moveBy(-inlineBoundingBoxOffset); |
if (m_location != localPoint) { |
- positionOrOffsetChanged = true; |
setNeedsRepaint(); |
} |
m_location = localPoint; |
@@ -824,7 +823,6 @@ bool PaintLayer::updateLayerPosition() |
#if ENABLE(ASSERT) |
m_needsPositionUpdate = false; |
#endif |
- return positionOrOffsetChanged; |
} |
TransformationMatrix PaintLayer::perspectiveTransform() const |
@@ -1187,6 +1185,9 @@ void PaintLayer::addChild(PaintLayer* child, PaintLayer* beforeChild) |
child->m_parent = this; |
+ // The ancestor overflow layer is calculated during compositing inputs update and should not be set yet. |
+ ASSERT(!child->ancestorOverflowLayer()); |
+ |
setNeedsCompositingInputsUpdate(); |
if (!child->stackingNode()->isStacked() && !layoutObject()->documentBeingDestroyed()) |
@@ -1240,6 +1241,9 @@ PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild) |
oldChild->setPreviousSibling(0); |
oldChild->setNextSibling(0); |
oldChild->m_parent = 0; |
+ if (oldChild->ancestorOverflowLayer()) |
+ oldChild->ancestorOverflowLayer()->getScrollableArea()->invalidateStickyConstraintsFor(oldChild); |
+ oldChild->updateAncestorOverflowLayer(nullptr); |
dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |