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

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: fix failing tests 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..cafdeed2fbc6dd5f59e6a13d8f2dc6806610557e 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -3646,10 +3646,16 @@ void FrameView::updateScrollbars()
void FrameView::adjustScrollPositionFromUpdateScrollbars()
{
- DoublePoint adjustedScrollPosition = clampScrollPosition(scrollPositionDouble());
-
- if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged()) {
- ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticScroll);
+ DoublePoint clamped = clampScrollPosition(scrollPositionDouble());
+ // Restore before clamping because clamping clears the scroll anchor.
+ // TODO(ymalik): This same logic exists in PaintLayerScrollableArea.
+ // Remove when root-layer-scrolls is enabled.
+ if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring() && m_scrollAnchor.hasScroller()) {
+ m_scrollAnchor.restore();
+ clamped = clampScrollPosition(scrollPositionDouble());
+ }
+ if (clamped != scrollPositionDouble() || scrollOriginChanged()) {
+ 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