Index: third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp |
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp |
index e94f3ec8911803f061737fb1dce147b7e788a518..e8beec30ee0016712a5ea119191d3414a64d16ec 100644 |
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp |
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp |
@@ -4,7 +4,9 @@ |
#include "core/layout/compositing/CompositingInputsUpdater.h" |
+#include "core/frame/FrameView.h" |
#include "core/layout/LayoutBlock.h" |
+#include "core/layout/LayoutView.h" |
#include "core/layout/compositing/CompositedLayerMapping.h" |
#include "core/layout/compositing/PaintLayerCompositor.h" |
#include "core/paint/PaintLayer.h" |
@@ -97,6 +99,28 @@ void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd |
if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate) |
return; |
+ const PaintLayer* previousOverflowLayer = layer->ancestorOverflowLayer(); |
+ layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer); |
+ if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() && layer->layoutObject()->style()->position() == StickyPosition) { |
+ if (info.lastOverflowClipLayer != previousOverflowLayer) { |
+ // Old ancestor scroller should no longer have these constraints. |
+ ASSERT(!previousOverflowLayer || !previousOverflowLayer->getScrollableArea()->stickyConstraintsMap().contains(layer)); |
+ |
+ if (info.lastOverflowClipLayer->isRootLayer()) |
+ layer->layoutObject()->view()->frameView()->addViewportConstrainedObject(layer->layoutObject()); |
+ else if (previousOverflowLayer && previousOverflowLayer->isRootLayer()) |
+ layer->layoutObject()->view()->frameView()->removeViewportConstrainedObject(layer->layoutObject()); |
+ } |
+ layer->layoutObject()->updateStickyPositionConstraints(); |
+ |
+ // Sticky position constraints and ancestor overflow scroller affect |
+ // the sticky layer position, so we need to update it again here. |
+ // TODO(flackr): This should be refactored in the future to be clearer |
+ // (i.e. update layer position and ancestor inputs updates in the |
+ // same walk) |
+ layer->updateLayerPosition(); |
+ } |
+ |
m_geometryMap.pushMappingsToAncestor(layer, layer->parent()); |
if (layer->hasCompositedLayerMapping()) |
@@ -163,6 +187,9 @@ void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType upd |
if (layer->stackingNode()->isStackingContext()) |
info.ancestorStackingContext = layer; |
+ if (layer->isRootLayer() || layer->layoutObject()->hasOverflowClip()) |
+ info.lastOverflowClipLayer = layer; |
+ |
if (layer->scrollsOverflow()) |
info.lastScrollingAncestor = layer; |