Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Side by Side Diff: Source/platform/scroll/ScrollAnimatorNone.cpp

Issue 1161713004: Rename ScrollableArea::scroll to userScroll (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed comment Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/scroll/ScrollAnimatorNone.h ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(), &parameters); 426 bool needToScroll = data.updateDataFromParameters(step, delta, scrollableSiz e, WTF::monotonicallyIncreasingTime(), &parameters);
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
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
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollAnimatorNone.h ('k') | Source/platform/scroll/ScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698