| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // starting one. This ensures we latch for the duration of the | 140 // starting one. This ensures we latch for the duration of the |
| 141 // animation rather than animating multiple scrollers at the same time. | 141 // animation rather than animating multiple scrollers at the same time. |
| 142 return ScrollResult(false, false, delta.width(), delta.height()); | 142 return ScrollResult(false, false, delta.width(), delta.height()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool ScrollAnimator::willAnimateToOffset(const FloatPoint& targetPos) | 145 bool ScrollAnimator::willAnimateToOffset(const FloatPoint& targetPos) |
| 146 { | 146 { |
| 147 if (m_runState == RunState::PostAnimationCleanup) | 147 if (m_runState == RunState::PostAnimationCleanup) |
| 148 resetAnimationState(); | 148 resetAnimationState(); |
| 149 | 149 |
| 150 if (m_animationCurve && m_runState != RunState::WaitingToCancelOnCompositor)
{ | 150 if (m_runState == RunState::WaitingToCancelOnCompositor) { |
| 151 // Ignore user scroll if WaitingToCancelOnCompositor. Can be in this |
| 152 // state when holding down an arrow. |
| 153 // TODO(ymalik): Handle this case by either updating the target on the |
| 154 // current scroll or starting a new animation (see crbug.com/599876). |
| 155 return true; |
| 156 } |
| 157 |
| 158 if (m_animationCurve) { |
| 151 if ((targetPos - m_targetOffset).isZero()) | 159 if ((targetPos - m_targetOffset).isZero()) |
| 152 return true; | 160 return true; |
| 153 | 161 |
| 154 m_targetOffset = targetPos; | 162 m_targetOffset = targetPos; |
| 155 ASSERT(m_runState == RunState::RunningOnMainThread | 163 ASSERT(m_runState == RunState::RunningOnMainThread |
| 156 || m_runState == RunState::RunningOnCompositor | 164 || m_runState == RunState::RunningOnCompositor |
| 157 || m_runState == RunState::RunningOnCompositorButNeedsUpdate | 165 || m_runState == RunState::RunningOnCompositorButNeedsUpdate |
| 158 || m_runState == RunState::RunningOnCompositorButNeedsTakeover); | 166 || m_runState == RunState::RunningOnCompositorButNeedsTakeover); |
| 159 | 167 |
| 160 // Running on the main thread, simply update the target offset instead | 168 // Running on the main thread, simply update the target offset instead |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 421 } |
| 414 return true; | 422 return true; |
| 415 } | 423 } |
| 416 | 424 |
| 417 DEFINE_TRACE(ScrollAnimator) | 425 DEFINE_TRACE(ScrollAnimator) |
| 418 { | 426 { |
| 419 ScrollAnimatorBase::trace(visitor); | 427 ScrollAnimatorBase::trace(visitor); |
| 420 } | 428 } |
| 421 | 429 |
| 422 } // namespace blink | 430 } // namespace blink |
| OLD | NEW |