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

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

Issue 1173053003: Remove ScrollableArea::notifyScrollPositionChanged and cleanup scroll animators. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + remove updateScrollbars from FrameView::setScrollPosition 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
431 scrollableArea()->registerForAnimation(); 431 scrollableArea()->registerForAnimation();
432 } 432 }
433 return ScrollResultOneDimensional(needToScroll); 433 return ScrollResultOneDimensional(needToScroll);
434 } 434 }
435 435
436 void ScrollAnimatorNone::scrollToOffsetWithoutAnimation(const FloatPoint& offset , ScrollType scrollType) 436 void ScrollAnimatorNone::scrollToOffsetWithoutAnimation(const FloatPoint& offset )
437 { 437 {
438 stopAnimationTimerIfNeeded();
439
440 m_horizontalData.reset();
441 *m_horizontalData.m_currentPosition = offset.x();
442 m_horizontalData.m_desiredPosition = offset.x();
443 m_currentPosX = offset.x(); 438 m_currentPosX = offset.x();
444
445 m_verticalData.reset();
446 *m_verticalData.m_currentPosition = offset.y();
447 m_verticalData.m_desiredPosition = offset.y();
448 m_currentPosY = offset.y(); 439 m_currentPosY = offset.y();
449 440
450 notifyPositionChanged(scrollType); 441 // Must be called after setting the position since canceling the animation r esets
442 // the desired position to the current.
443 cancelAnimations();
444 notifyPositionChanged();
451 } 445 }
452 446
453 void ScrollAnimatorNone::cancelAnimations() 447 void ScrollAnimatorNone::cancelAnimations()
454 { 448 {
455 m_animationActive = false; 449 m_animationActive = false;
450
451 m_horizontalData.reset();
452 m_verticalData.reset();
453 m_horizontalData.m_desiredPosition = m_currentPosX;
454 m_verticalData.m_desiredPosition = m_currentPosY;
456 } 455 }
457 456
458 void ScrollAnimatorNone::serviceScrollAnimations() 457 void ScrollAnimatorNone::serviceScrollAnimations()
459 { 458 {
460 if (m_animationActive) 459 if (m_animationActive)
461 animationTimerFired(); 460 animationTimerFired();
462 } 461 }
463 462
464 bool ScrollAnimatorNone::hasRunningAnimation() const 463 bool ScrollAnimatorNone::hasRunningAnimation() const
465 { 464 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 continueAnimation = true; 502 continueAnimation = true;
504 if (m_verticalData.m_startTime && m_verticalData.animateScroll(currentTime)) 503 if (m_verticalData.m_startTime && m_verticalData.animateScroll(currentTime))
505 continueAnimation = true; 504 continueAnimation = true;
506 505
507 if (continueAnimation) 506 if (continueAnimation)
508 startNextTimer(); 507 startNextTimer();
509 else 508 else
510 m_animationActive = false; 509 m_animationActive = false;
511 510
512 TRACE_EVENT0("blink", "ScrollAnimatorNone::notifyPositionChanged"); 511 TRACE_EVENT0("blink", "ScrollAnimatorNone::notifyPositionChanged");
513 notifyPositionChanged(UserScroll); 512 notifyPositionChanged();
514 513
515 if (!continueAnimation) 514 if (!continueAnimation)
516 animationDidFinish(); 515 animationDidFinish();
517 } 516 }
518 517
519 void ScrollAnimatorNone::startNextTimer() 518 void ScrollAnimatorNone::startNextTimer()
520 { 519 {
521 if (scrollableArea()->scheduleAnimation()) 520 if (scrollableArea()->scheduleAnimation())
522 m_animationActive = true; 521 m_animationActive = true;
523 } 522 }
524 523
525 bool ScrollAnimatorNone::animationTimerActive() 524 bool ScrollAnimatorNone::animationTimerActive()
526 { 525 {
527 return m_animationActive; 526 return m_animationActive;
528 } 527 }
529 528
530 void ScrollAnimatorNone::stopAnimationTimerIfNeeded() 529 void ScrollAnimatorNone::stopAnimationTimerIfNeeded()
531 { 530 {
532 if (animationTimerActive()) 531 if (animationTimerActive())
533 m_animationActive = false; 532 m_animationActive = false;
534 } 533 }
535 534
536 } // namespace blink 535 } // 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