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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.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 | « third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 52b9388e24a8e3a1c000d9436060d890b878bdd8..ef02d56e2f91c34acb000b704f507d7d91b3ea27 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -752,11 +752,14 @@ void PaintLayerScrollableArea::clampScrollPositionsAfterLayout()
return;
}
- DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble());
- if (clampedScrollPosition != scrollPositionDouble())
- ScrollableArea::setScrollPosition(clampedScrollPosition, ProgrammaticScroll);
- else if (scrollOriginChanged())
- scrollPositionChanged(clampedScrollPosition, ProgrammaticScroll);
+ DoublePoint clamped = clampScrollPosition(scrollPositionDouble());
+ // Restore before clamping because clamping clears the scroll anchor.
+ if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring() && m_scrollAnchor.hasScroller()) {
+ m_scrollAnchor.restore();
+ clamped = clampScrollPosition(scrollPositionDouble());
+ }
+ if (clamped != scrollPositionDouble() || scrollOriginChanged())
+ ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll);
setNeedsScrollPositionClamp(false);
resetScrollOriginChanged();
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698