Chromium Code Reviews| 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..060b08f9e9a2005a1bb42baeede4184a7312f47a 100644 |
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| @@ -243,20 +243,11 @@ void ScrollAnchor::adjust(IntSize adjustment) |
| { |
| DoublePoint desiredPos = m_scroller->scrollPositionDouble() + adjustment; |
| ScrollAnimatorBase* animator = m_scroller->existingScrollAnimator(); |
|
skobes
2016/05/27 17:58:30
Could these five lines be reduced to
m_scroller
ymalik
2016/05/27 20:03:11
Done.
|
| - 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(); |
| + |
| + if (!animator) |
| m_scroller->setScrollPosition(desiredPos, AnchoringScroll); |
| - animator->userScroll(ScrollByPixel, pendingDelta); |
| - } |
| + else |
| + animator->adjustAnimationAndSetScrollPosition(adjustment, AnchoringScroll); |
| if (m_current && m_lastAdjusted.m_anchorObject != m_current.m_anchorObject) { |
| m_lastAdjusted.clear(); |