OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 if (registerAndScheduleAnimation()) | 184 if (registerAndScheduleAnimation()) |
185 m_runState = RunState::WaitingToSendToCompositor; | 185 m_runState = RunState::WaitingToSendToCompositor; |
186 | 186 |
187 return true; | 187 return true; |
188 } | 188 } |
189 | 189 |
190 void ScrollAnimator::adjustAnimationAndSetScrollPosition( | 190 void ScrollAnimator::adjustAnimationAndSetScrollPosition( |
191 const DoublePoint& position, | 191 const DoublePoint& position, |
192 ScrollType scrollType) { | 192 ScrollType scrollType) { |
193 IntSize adjustment = | 193 DoublePoint adjustedPos = m_scrollableArea->clampScrollPosition(position); |
194 roundedIntPoint(position) - | 194 IntSize actualAdjustment = |
| 195 roundedIntPoint(adjustedPos) - |
195 roundedIntPoint(m_scrollableArea->scrollPositionDouble()); | 196 roundedIntPoint(m_scrollableArea->scrollPositionDouble()); |
196 | 197 |
197 scrollPositionChanged(position, scrollType); | 198 scrollPositionChanged(adjustedPos, scrollType); |
198 | 199 |
199 if (m_runState == RunState::Idle) { | 200 if (m_runState == RunState::Idle) { |
200 adjustImplOnlyScrollOffsetAnimation(adjustment); | 201 adjustImplOnlyScrollOffsetAnimation(actualAdjustment); |
201 } else if (hasRunningAnimation()) { | 202 } else if (hasRunningAnimation()) { |
202 m_targetOffset += toFloatSize(adjustment); | 203 m_targetOffset += toFloatSize(actualAdjustment); |
203 if (m_animationCurve) { | 204 if (m_animationCurve) { |
204 m_animationCurve->applyAdjustment(adjustment); | 205 m_animationCurve->applyAdjustment(actualAdjustment); |
205 if (m_runState != RunState::RunningOnMainThread && | 206 if (m_runState != RunState::RunningOnMainThread && |
206 registerAndScheduleAnimation()) | 207 registerAndScheduleAnimation()) |
207 m_runState = RunState::RunningOnCompositorButNeedsAdjustment; | 208 m_runState = RunState::RunningOnCompositorButNeedsAdjustment; |
208 } | 209 } |
209 } | 210 } |
210 } | 211 } |
211 | 212 |
212 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset) { | 213 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset) { |
213 m_currentPos = offset; | 214 m_currentPos = offset; |
214 | 215 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 return false; | 433 return false; |
433 } | 434 } |
434 return true; | 435 return true; |
435 } | 436 } |
436 | 437 |
437 DEFINE_TRACE(ScrollAnimator) { | 438 DEFINE_TRACE(ScrollAnimator) { |
438 ScrollAnimatorBase::trace(visitor); | 439 ScrollAnimatorBase::trace(visitor); |
439 } | 440 } |
440 | 441 |
441 } // namespace blink | 442 } // namespace blink |
OLD | NEW |