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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 2015113003: Correctly update scroll offset animations in response to scroll anchoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 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/layout/ScrollAnchor.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
index 63b69a4cdaa949962a24bf21fab031e9f84fe681..ea8dbb0c10ecbef2ad26e6c8a3300fa347185783 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -241,22 +241,7 @@ void ScrollAnchor::restore()
void ScrollAnchor::adjust(IntSize adjustment)
{
- DoublePoint desiredPos = m_scroller->scrollPositionDouble() + adjustment;
- ScrollAnimatorBase* animator = m_scroller->existingScrollAnimator();
- if (!animator || !animator->hasRunningAnimation()) {
- m_scroller->setScrollPosition(desiredPos, AnchoringScroll);
- animator->adjustImplOnlyScrollOffsetAnimation(FloatSize(adjustment));
- } else {
- // If in the middle of a scroll animation, stop the animation, make
- // the adjustment, and continue the animation on the pending delta.
- // TODO(skobes): This is not quite right, we are starting a new curve without
- // saving our progress on the existing curve.
- FloatSize pendingDelta = animator->desiredTargetPosition() -
- FloatPoint(m_scroller->scrollPositionDouble());
- animator->cancelAnimation();
- m_scroller->setScrollPosition(desiredPos, AnchoringScroll);
- animator->userScroll(ScrollByPixel, pendingDelta);
- }
+ m_scroller->scrollAnimator().adjustAnimationAndSetScrollPosition(adjustment, AnchoringScroll);
if (m_current && m_lastAdjusted.m_anchorObject != m_current.m_anchorObject) {
m_lastAdjusted.clear();

Powered by Google App Engine
This is Rietveld 408576698