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

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

Issue 2152773002: Make scroll anchoring adjustment when the bounds of a scroller is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call restore from PLSA/FV Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9e64a983ed273135f768d12e98d0c4a98780eba9..df30fbde50a018f0153d7606b648ddc7d4f91e31 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -3646,10 +3646,19 @@ void FrameView::updateScrollbars()
void FrameView::adjustScrollPositionFromUpdateScrollbars()
{
- DoublePoint adjustedScrollPosition = clampScrollPosition(scrollPositionDouble());
-
- if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged()) {
- ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticScroll);
+ DoublePoint clamped = clampScrollPosition(scrollPositionDouble());
+ if (clamped != scrollPositionDouble() || scrollOriginChanged()) {
+ // Since the scroll bounds have changed and the scroller is at a position
+ // that is outside its new bounds. Calling ScrollAnchor::restore
+ // ensures that no visible jump is seen when clamping.
skobes 2016/07/15 20:17:42 I think this comment should mention that we restor
ymalik 2016/07/18 16:08:48 Done.
+ // TODO(ymalik): This same logic exists in PaintLayerScrollableArea.
+ // Remove when root-layer-scrolls is enabled.
+ if (shouldPerformScrollAnchoring() && m_scrollAnchor.hasScroller()) {
+ m_scrollAnchor.restore();
+ clamped = clampScrollPosition(scrollPositionDouble());
+ }
+ if (clamped != scrollPositionDouble())
+ ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll);
resetScrollOriginChanged();
}
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698