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

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: Move compositor plumbing into a separate review. Created 5 years, 3 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 a956cd4ee393e62f18998302b8d94965cdf65e8a..e7a6f37acb34b59b737cb6904d742321b83aba9c 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1553,7 +1553,7 @@ void FrameView::didScrollTimerFired(Timer<FrameView>*)
}
}
-void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
+void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
{
// Nothing to do after scrolling if there are no fixed position elements.
if (!hasViewportConstrainedObjects())
@@ -1561,6 +1561,14 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
RefPtrWillBeRawPtr<FrameView> protect(this);
+ // Update sticky positioned elements which scroll with the viewport.
chrishtr 2015/10/06 17:08:33 Are position: sticky elements spec'ed to stick to
flackr 2015/10/07 20:38:12 They're spec'ed to stick to the viewport if no anc
+ for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
+ LayoutObject* layoutObject = viewportConstrainedObject;
+ DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
+ if (layoutObject->style()->position() == StickyPosition && layer->scrollsWithViewport())
+ layer->updateLayerPositionsAfterOverflowScroll(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.
@@ -2129,7 +2137,7 @@ void FrameView::scrollTo(const DoublePoint& newPosition)
m_pendingScrollDelta += scrollDelta;
clearScrollAnchor();
- updateLayersAndCompositingAfterScrollIfNeeded();
+ updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
scrollPositionChanged();
frame().loader().client()->didChangeScrollOffset();
}
@@ -3158,13 +3166,19 @@ int FrameView::scrollSize(ScrollbarOrientation orientation) const
return scrollbar->totalSize() - scrollbar->visibleSize();
}
-void FrameView::setScrollOffset(const IntPoint& offset, ScrollType)
+void FrameView::setScrollOffset(const IntPoint& offset, ScrollType type)
{
+ // Scrolling is triggered directly in response to events but should be
+ // processed after compositing update. http://crbug.com/420741
+ DisableCompositingQueryAsserts disabler;
chrishtr 2015/10/06 17:08:33 What is the code path that is now active which lea
flackr 2015/10/07 20:38:12 The stack trace is here: #0 0x00007fdaea9281b1 in
chrishtr 2015/11/04 01:40:44 Why is the compositing data stale when setScrollOf
flackr 2015/11/25 21:03:01 We have the same disabler in PaintLayerScrollableA
scrollTo(clampScrollPosition(offset));
}
-void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType)
+void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType type)
{
+ // Scrolling is triggered directly in response to events but should be
+ // processed after compositing update. http://crbug.com/420741
+ DisableCompositingQueryAsserts disabler;
chrishtr 2015/10/06 17:08:33 Same question here.
flackr 2015/10/07 20:38:12 Same as above.
scrollTo(clampScrollPosition(offset));
}

Powered by Google App Engine
This is Rietveld 408576698