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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 { | 392 { |
393 } | 393 } |
394 | 394 |
395 ScrollAnimatorNone::~ScrollAnimatorNone() | 395 ScrollAnimatorNone::~ScrollAnimatorNone() |
396 { | 396 { |
397 stopAnimationTimerIfNeeded(); | 397 stopAnimationTimerIfNeeded(); |
398 } | 398 } |
399 | 399 |
400 ScrollAnimatorNone::Parameters ScrollAnimatorNone::parametersForScrollGranularit
y(ScrollGranularity granularity) const | 400 ScrollAnimatorNone::Parameters ScrollAnimatorNone::parametersForScrollGranularit
y(ScrollGranularity granularity) const |
401 { | 401 { |
402 #if !PLATFORM(QT) | |
403 switch (granularity) { | 402 switch (granularity) { |
404 case ScrollByDocument: | 403 case ScrollByDocument: |
405 return Parameters(true, 20 * kTickTime, 10 * kTickTime, Cubic, 10 * kTic
kTime, Cubic, 10 * kTickTime, Linear, 1); | 404 return Parameters(true, 20 * kTickTime, 10 * kTickTime, Cubic, 10 * kTic
kTime, Cubic, 10 * kTickTime, Linear, 1); |
406 case ScrollByLine: | 405 case ScrollByLine: |
407 return Parameters(true, 10 * kTickTime, 7 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Linear, 1); | 406 return Parameters(true, 10 * kTickTime, 7 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Linear, 1); |
408 case ScrollByPage: | 407 case ScrollByPage: |
409 return Parameters(true, 15 * kTickTime, 10 * kTickTime, Cubic, 5 * kTick
Time, Cubic, 5 * kTickTime, Linear, 1); | 408 return Parameters(true, 15 * kTickTime, 10 * kTickTime, Cubic, 5 * kTick
Time, Cubic, 5 * kTickTime, Linear, 1); |
410 case ScrollByPixel: | 409 case ScrollByPixel: |
411 return Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Quadratic, 1.25); | 410 return Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickT
ime, Cubic, 3 * kTickTime, Quadratic, 1.25); |
412 default: | 411 default: |
413 ASSERT_NOT_REACHED(); | 412 ASSERT_NOT_REACHED(); |
414 } | 413 } |
415 #else | |
416 // This is a slightly different strategy for the animation with a steep atta
ck curve and natural release curve. | |
417 // The fast acceleration makes the animation look more responsive to user in
put. | |
418 switch (granularity) { | |
419 case ScrollByDocument: | |
420 return Parameters(true, 20 * kTickTime, 10 * kTickTime, Cubic, 6 * kTick
Time, Quadratic, 10 * kTickTime, Quadratic, 22 * kTickTime); | |
421 case ScrollByLine: | |
422 return Parameters(true, 6 * kTickTime, 5 * kTickTime, Cubic, 1 * kTickTi
me, Quadratic, 4 * kTickTime, Linear, 1); | |
423 case ScrollByPage: | |
424 return Parameters(true, 12 * kTickTime, 10 * kTickTime, Cubic, 3 * kTick
Time, Quadratic, 6 * kTickTime, Linear, 1); | |
425 case ScrollByPixel: | |
426 return Parameters(true, 8 * kTickTime, 3 * kTickTime, Cubic, 2 * kTickTi
me, Quadratic, 5 * kTickTime, Quadratic, 1.25); | |
427 default: | |
428 ASSERT_NOT_REACHED(); | |
429 } | |
430 #endif | |
431 return Parameters(); | 414 return Parameters(); |
432 } | 415 } |
433 | 416 |
434 bool ScrollAnimatorNone::scroll(ScrollbarOrientation orientation, ScrollGranular
ity granularity, float step, float multiplier) | 417 bool ScrollAnimatorNone::scroll(ScrollbarOrientation orientation, ScrollGranular
ity granularity, float step, float multiplier) |
435 { | 418 { |
436 if (!m_scrollableArea->scrollAnimatorEnabled()) | 419 if (!m_scrollableArea->scrollAnimatorEnabled()) |
437 return ScrollAnimator::scroll(orientation, granularity, step, multiplier
); | 420 return ScrollAnimator::scroll(orientation, granularity, step, multiplier
); |
438 | 421 |
439 #if PLATFORM(CHROMIUM) | 422 #if PLATFORM(CHROMIUM) |
440 TRACE_EVENT0("webkit", "ScrollAnimatorNone::scroll"); | 423 TRACE_EVENT0("webkit", "ScrollAnimatorNone::scroll"); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 #if USE(REQUEST_ANIMATION_FRAME_TIMER) | 574 #if USE(REQUEST_ANIMATION_FRAME_TIMER) |
592 m_animationTimer.stop(); | 575 m_animationTimer.stop(); |
593 #else | 576 #else |
594 m_animationActive = false; | 577 m_animationActive = false; |
595 #endif | 578 #endif |
596 } | 579 } |
597 | 580 |
598 } // namespace WebCore | 581 } // namespace WebCore |
599 | 582 |
600 #endif // ENABLE(SMOOTH_SCROLLING) | 583 #endif // ENABLE(SMOOTH_SCROLLING) |
OLD | NEW |