OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/ScrollAnchor.h" | 5 #include "core/layout/ScrollAnchor.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
10 #include "core/layout/line/InlineTextBox.h" | 10 #include "core/layout/line/InlineTextBox.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 adjust(adjustment); | 240 adjust(adjustment); |
241 } | 241 } |
242 | 242 |
243 void ScrollAnchor::adjust(IntSize adjustment) | 243 void ScrollAnchor::adjust(IntSize adjustment) |
244 { | 244 { |
245 DoublePoint desiredPos = m_scroller->scrollPositionDouble() + adjustment; | 245 DoublePoint desiredPos = m_scroller->scrollPositionDouble() + adjustment; |
246 ScrollAnimatorBase* animator = m_scroller->existingScrollAnimator(); | 246 ScrollAnimatorBase* animator = m_scroller->existingScrollAnimator(); |
247 if (!animator || !animator->hasRunningAnimation()) { | 247 if (!animator || !animator->hasRunningAnimation()) { |
248 m_scroller->setScrollPosition(desiredPos, AnchoringScroll); | 248 m_scroller->setScrollPosition(desiredPos, AnchoringScroll); |
| 249 animator->updateImplOnlyScrollOffsetAnimation(FloatSize(adjustment)); |
249 } else { | 250 } else { |
250 // If in the middle of a scroll animation, stop the animation, make | 251 // If in the middle of a scroll animation, stop the animation, make |
251 // the adjustment, and continue the animation on the pending delta. | 252 // the adjustment, and continue the animation on the pending delta. |
252 // TODO(skobes): This is not quite right, we are starting a new curve wi
thout | 253 // TODO(skobes): This is not quite right, we are starting a new curve wi
thout |
253 // saving our progress on the existing curve. | 254 // saving our progress on the existing curve. |
254 FloatSize pendingDelta = animator->desiredTargetPosition() - | 255 FloatSize pendingDelta = animator->desiredTargetPosition() - |
255 FloatPoint(m_scroller->scrollPositionDouble()); | 256 FloatPoint(m_scroller->scrollPositionDouble()); |
256 animator->cancelAnimation(); | 257 animator->cancelAnimation(); |
257 m_scroller->setScrollPosition(desiredPos, AnchoringScroll); | 258 m_scroller->setScrollPosition(desiredPos, AnchoringScroll); |
258 animator->userScroll(ScrollByPixel, pendingDelta); | 259 animator->userScroll(ScrollByPixel, pendingDelta); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) | 296 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) |
296 { | 297 { |
297 if (m_current.m_anchorObject == layoutObject) | 298 if (m_current.m_anchorObject == layoutObject) |
298 m_current.clear(); | 299 m_current.clear(); |
299 if (m_lastAdjusted.m_anchorObject == layoutObject) | 300 if (m_lastAdjusted.m_anchorObject == layoutObject) |
300 m_lastAdjusted.clear(); | 301 m_lastAdjusted.clear(); |
301 } | 302 } |
302 | 303 |
303 } // namespace blink | 304 } // namespace blink |
OLD | NEW |