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

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: 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
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..cfc4185b17a6514fbfc6db8f091ac8eed0b4fe8c 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -752,14 +752,21 @@ 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());
+ 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.
+ if (shouldPerformScrollAnchoring() && m_scrollAnchor.hasScroller()) {
+ m_scrollAnchor.restore();
+ clamped = clampScrollPosition(scrollPositionDouble());
+ }
+ if (clamped != scrollPositionDouble())
+ ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll);
+ resetScrollOriginChanged();
+ }
setNeedsScrollPositionClamp(false);
- resetScrollOriginChanged();
m_scrollbarManager.destroyDetachedScrollbars();
}

Powered by Google App Engine
This is Rietveld 408576698