Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1308273010: Adapt and reland old position sticky implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merge and attempt to fix base URL Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 6dc9581abac44e64276b3d543581cd8684337713..665c23f07c336dfd7a9896fff59cb587ceb11416 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1556,7 +1556,7 @@ void FrameView::didScrollTimerFired(Timer<FrameView>*)
m_frame->document()->fetcher()->updateAllImageResourcePriorities();
}
-void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
+void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
{
// Nothing to do after scrolling if there are no fixed position elements.
if (!hasViewportConstrainedObjects())
@@ -1564,6 +1564,14 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
RefPtrWillBeRawPtr<FrameView> protect(this);
+ // Update sticky position objects which are stuck to the viewport.
+ for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
chrishtr 2015/11/04 01:55:18 Shouldn't this go in PaintLayerScrollableArea? Thi
flackr 2015/11/25 20:47:52 The root frame doesn't use PaintLayerScrollableAre
chrishtr 2015/12/09 00:37:38 What about iframes?
+ LayoutObject* layoutObject = viewportConstrainedObject;
+ PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
+ if (layoutObject->style()->position() == StickyPosition)
+ layer->updateLayerPositionAfterFrameScroll(scrollDelta);
+ }
+
// If there fixed position elements, scrolling may cause compositing layers to change.
// Update widget and layer positions after scrolling, but only if we're not inside of
// layout.
@@ -2114,7 +2122,7 @@ void FrameView::scrollTo(const DoublePoint& newPosition)
m_pendingScrollDelta += scrollDelta;
clearScrollAnchor();
- updateLayersAndCompositingAfterScrollIfNeeded();
+ updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
scrollPositionChanged();
frame().loader().client()->didChangeScrollOffset();
}

Powered by Google App Engine
This is Rietveld 408576698