| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 case ScrollByPage: | 387 case ScrollByPage: |
| 388 return Parameters(true, 15 * kTickTime, 10 * kTickTime, Cubic, 5 * kTick
Time, Cubic, 5 * kTickTime, Linear, 1); | 388 return Parameters(true, 15 * kTickTime, 10 * kTickTime, Cubic, 5 * kTick
Time, Cubic, 5 * kTickTime, Linear, 1); |
| 389 case ScrollByPixel: | 389 case ScrollByPixel: |
| 390 return Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Quadratic, 1.25); | 390 return Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Quadratic, 1.25); |
| 391 default: | 391 default: |
| 392 ASSERT_NOT_REACHED(); | 392 ASSERT_NOT_REACHED(); |
| 393 } | 393 } |
| 394 return Parameters(); | 394 return Parameters(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 ScrollResultOneDimensional ScrollAnimatorNone::scroll(ScrollbarOrientation orien
tation, ScrollGranularity granularity, float step, float delta) | 397 ScrollResultOneDimensional ScrollAnimatorNone::userScroll(ScrollbarOrientation o
rientation, ScrollGranularity granularity, float step, float delta) |
| 398 { | 398 { |
| 399 if (!m_scrollableArea->scrollAnimatorEnabled()) | 399 if (!m_scrollableArea->scrollAnimatorEnabled()) |
| 400 return ScrollAnimator::scroll(orientation, granularity, step, delta); | 400 return ScrollAnimator::userScroll(orientation, granularity, step, delta)
; |
| 401 | 401 |
| 402 TRACE_EVENT0("blink", "ScrollAnimatorNone::scroll"); | 402 TRACE_EVENT0("blink", "ScrollAnimatorNone::scroll"); |
| 403 | 403 |
| 404 // FIXME: get the type passed in. MouseWheel could also be by line, but shou
ld still have different | 404 // FIXME: get the type passed in. MouseWheel could also be by line, but shou
ld still have different |
| 405 // animation parameters than the keyboard. | 405 // animation parameters than the keyboard. |
| 406 Parameters parameters; | 406 Parameters parameters; |
| 407 switch (granularity) { | 407 switch (granularity) { |
| 408 case ScrollByDocument: | 408 case ScrollByDocument: |
| 409 case ScrollByLine: | 409 case ScrollByLine: |
| 410 case ScrollByPage: | 410 case ScrollByPage: |
| 411 case ScrollByPixel: | 411 case ScrollByPixel: |
| 412 parameters = parametersForScrollGranularity(granularity); | 412 parameters = parametersForScrollGranularity(granularity); |
| 413 break; | 413 break; |
| 414 case ScrollByPrecisePixel: | 414 case ScrollByPrecisePixel: |
| 415 return ScrollAnimator::scroll(orientation, granularity, step, delta); | 415 return ScrollAnimator::userScroll(orientation, granularity, step, delta)
; |
| 416 } | 416 } |
| 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::scroll(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 if (needToScroll && !animationTimerActive()) { | 427 if (needToScroll && !animationTimerActive()) { |
| 428 m_startTime = data.m_startTime; | 428 m_startTime = data.m_startTime; |
| 429 animationWillStart(); | 429 animationWillStart(); |
| 430 animationTimerFired(); | 430 animationTimerFired(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return m_animationActive; | 527 return m_animationActive; |
| 528 } | 528 } |
| 529 | 529 |
| 530 void ScrollAnimatorNone::stopAnimationTimerIfNeeded() | 530 void ScrollAnimatorNone::stopAnimationTimerIfNeeded() |
| 531 { | 531 { |
| 532 if (animationTimerActive()) | 532 if (animationTimerActive()) |
| 533 m_animationActive = false; | 533 m_animationActive = false; |
| 534 } | 534 } |
| 535 | 535 |
| 536 } // namespace blink | 536 } // namespace blink |
| OLD | NEW |