From 8b43093169597d0bdc66181b4c14e5af344880cf Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Fri, 18 Mar 2011 15:41:38 +0000 Subject: Makes dragging multiple discontingious tabs animate the tabs into place. BUG=30572 TEST=none, just make sure tab selection isn't broken. R=ben@chromium.org Review URL: http://codereview.chromium.org/6712012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78695 0039d316-1c4b-4281-b951-d872f2087c98 --- views/animation/bounds_animator.cc | 9 +++++++++ views/animation/bounds_animator.h | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'views') diff --git a/views/animation/bounds_animator.cc b/views/animation/bounds_animator.cc index 09d880e..7039eb7 100644 --- a/views/animation/bounds_animator.cc +++ b/views/animation/bounds_animator.cc @@ -68,6 +68,15 @@ void BoundsAnimator::AnimateViewTo(View* view, const gfx::Rect& target) { CleanupData(true, &existing_data, NULL); } +void BoundsAnimator::SetTargetBounds(View* view, const gfx::Rect& target) { + if (!IsAnimating(view)) { + AnimateViewTo(view, target); + return; + } + + data_[view].target_bounds = target; +} + void BoundsAnimator::SetAnimationForView(View* view, SlideAnimation* animation) { DCHECK(animation); diff --git a/views/animation/bounds_animator.h b/views/animation/bounds_animator.h index d771912..e11f484 100644 --- a/views/animation/bounds_animator.h +++ b/views/animation/bounds_animator.h @@ -57,6 +57,11 @@ class BoundsAnimator : public ui::AnimationDelegate, // (after being notified that the animation was canceled). void AnimateViewTo(View* view, const gfx::Rect& target); + // Similar to |AnimateViewTo|, but does not reset the animation, only the + // target bounds. If |view| is not being animated this is the same as + // invoking |AnimateViewTo|. + void SetTargetBounds(View* view, const gfx::Rect& target); + // Sets the animation for the specified view. BoundsAnimator takes ownership // of the specified animation. void SetAnimationForView(View* view, ui::SlideAnimation* animation); -- cgit v1.1