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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 // If the individual input setting is disabled, bail. | 418 // If the individual input setting is disabled, bail. |
419 if (!parameters.m_isEnabled) | 419 if (!parameters.m_isEnabled) |
420 return ScrollAnimator::userScroll(orientation, granularity, step, delta)
; | 420 return ScrollAnimator::userScroll(orientation, granularity, step, delta)
; |
421 | 421 |
422 // This is an animatable scroll. Set the animation in motion using the appro
priate parameters. | 422 // This is an animatable scroll. Set the animation in motion using the appro
priate parameters. |
423 float scrollableSize = static_cast<float>(m_scrollableArea->scrollSize(orien
tation)); | 423 float scrollableSize = static_cast<float>(m_scrollableArea->scrollSize(orien
tation)); |
424 | 424 |
425 PerAxisData& data = (orientation == VerticalScrollbar) ? m_verticalData : m_
horizontalData; | 425 PerAxisData& data = (orientation == VerticalScrollbar) ? m_verticalData : m_
horizontalData; |
426 bool needToScroll = data.updateDataFromParameters(step, delta, scrollableSiz
e, WTF::monotonicallyIncreasingTime(), ¶meters); | 426 bool needToScroll = data.updateDataFromParameters(step, delta, scrollableSiz
e, WTF::monotonicallyIncreasingTime(), ¶meters); |
| 427 float unusedDelta = needToScroll ? delta - (data.m_desiredPosition - *data.m
_currentPosition) : delta; |
427 if (needToScroll && !animationTimerActive()) { | 428 if (needToScroll && !animationTimerActive()) { |
428 m_startTime = data.m_startTime; | 429 m_startTime = data.m_startTime; |
429 animationWillStart(); | 430 animationWillStart(); |
430 animationTimerFired(); | 431 animationTimerFired(); |
431 scrollableArea()->registerForAnimation(); | 432 scrollableArea()->registerForAnimation(); |
432 } | 433 } |
433 return ScrollResultOneDimensional(needToScroll); | 434 return ScrollResultOneDimensional(needToScroll, unusedDelta); |
434 } | 435 } |
435 | 436 |
436 void ScrollAnimatorNone::scrollToOffsetWithoutAnimation(const FloatPoint& offset
) | 437 void ScrollAnimatorNone::scrollToOffsetWithoutAnimation(const FloatPoint& offset
) |
437 { | 438 { |
438 m_currentPosX = offset.x(); | 439 m_currentPosX = offset.x(); |
439 m_currentPosY = offset.y(); | 440 m_currentPosY = offset.y(); |
440 | 441 |
441 // Must be called after setting the position since canceling the animation r
esets | 442 // Must be called after setting the position since canceling the animation r
esets |
442 // the desired position to the current. | 443 // the desired position to the current. |
443 cancelAnimations(); | 444 cancelAnimations(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 return m_animationActive; | 527 return m_animationActive; |
527 } | 528 } |
528 | 529 |
529 void ScrollAnimatorNone::stopAnimationTimerIfNeeded() | 530 void ScrollAnimatorNone::stopAnimationTimerIfNeeded() |
530 { | 531 { |
531 if (animationTimerActive()) | 532 if (animationTimerActive()) |
532 m_animationActive = false; | 533 m_animationActive = false; |
533 } | 534 } |
534 | 535 |
535 } // namespace blink | 536 } // namespace blink |
OLD | NEW |