| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/animation/bounds_animator.h" | 5 #include "ui/views/animation/bounds_animator.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "ui/base/animation/animation_container.h" | 8 #include "ui/base/animation/animation_container.h" |
| 9 #include "ui/base/animation/slide_animation.h" | 9 #include "ui/base/animation/slide_animation.h" |
| 10 #include "ui/views/animation/bounds_animator_observer.h" | 10 #include "ui/views/animation/bounds_animator_observer.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 void BoundsAnimator::AnimationProgressed(const Animation* animation) { | 229 void BoundsAnimator::AnimationProgressed(const Animation* animation) { |
| 230 DCHECK(animation_to_view_.find(animation) != animation_to_view_.end()); | 230 DCHECK(animation_to_view_.find(animation) != animation_to_view_.end()); |
| 231 | 231 |
| 232 View* view = animation_to_view_[animation]; | 232 View* view = animation_to_view_[animation]; |
| 233 DCHECK(view); | 233 DCHECK(view); |
| 234 const Data& data = data_[view]; | 234 const Data& data = data_[view]; |
| 235 gfx::Rect new_bounds = | 235 gfx::Rect new_bounds = |
| 236 animation->CurrentValueBetween(data.start_bounds, data.target_bounds); | 236 animation->CurrentValueBetween(data.start_bounds, data.target_bounds); |
| 237 if (new_bounds != view->bounds()) { | 237 if (new_bounds != view->bounds()) { |
| 238 gfx::Rect total_bounds = view->bounds(); | 238 gfx::Rect total_bounds = gfx::UnionRects(new_bounds, view->bounds()); |
| 239 total_bounds.Union(new_bounds); | |
| 240 | 239 |
| 241 // Build up the region to repaint in repaint_bounds_. We'll do the repaint | 240 // Build up the region to repaint in repaint_bounds_. We'll do the repaint |
| 242 // when all animations complete (in AnimationContainerProgressed). | 241 // when all animations complete (in AnimationContainerProgressed). |
| 243 repaint_bounds_.Union(total_bounds); | 242 repaint_bounds_.Union(total_bounds); |
| 244 | 243 |
| 245 view->SetBoundsRect(new_bounds); | 244 view->SetBoundsRect(new_bounds); |
| 246 } | 245 } |
| 247 | 246 |
| 248 if (data.delegate) | 247 if (data.delegate) |
| 249 data.delegate->AnimationProgressed(animation); | 248 data.delegate->AnimationProgressed(animation); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 277 FOR_EACH_OBSERVER(BoundsAnimatorObserver, | 276 FOR_EACH_OBSERVER(BoundsAnimatorObserver, |
| 278 observers_, | 277 observers_, |
| 279 OnBoundsAnimatorDone(this)); | 278 OnBoundsAnimatorDone(this)); |
| 280 } | 279 } |
| 281 } | 280 } |
| 282 | 281 |
| 283 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { | 282 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { |
| 284 } | 283 } |
| 285 | 284 |
| 286 } // namespace views | 285 } // namespace views |
| OLD | NEW |