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

Unified Diff: chrome/browser/views/tabs/grid.cc

Issue 126185: Improved tab overview animations with better animation and wiring to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/tabs/grid.cc
===================================================================
--- chrome/browser/views/tabs/grid.cc (revision 18480)
+++ chrome/browser/views/tabs/grid.cc (working copy)
@@ -63,6 +63,21 @@
CalculateTargetBoundsAndStartAnimation();
}
+int Grid::AnimationPosition(int start, int target) {
+ return start + static_cast<int>(
+ static_cast<double>(target - start) * animation_.GetCurrentValue());
+}
+
+gfx::Rect Grid::AnimationPosition(const gfx::Rect& start_bounds,
+ const gfx::Rect& target_bounds) {
+ return gfx::Rect(AnimationPosition(start_bounds.x(), target_bounds.x()),
+ AnimationPosition(start_bounds.y(), target_bounds.y()),
+ AnimationPosition(start_bounds.width(),
+ target_bounds.width()),
+ AnimationPosition(start_bounds.height(),
+ target_bounds.height()));
+}
+
void Grid::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (modifying_children_ || parent != this)
return;
@@ -131,15 +146,8 @@
View* view = GetChildViewAt(i);
gfx::Rect start_bounds = start_bounds_[i];
gfx::Rect target_bounds = target_bounds_[i];
- if (static_cast<int>(i) != floating_index_) {
- view->SetBounds(
- gfx::Rect(AnimationPosition(start_bounds.x(), target_bounds.x()),
- AnimationPosition(start_bounds.y(), target_bounds.y()),
- AnimationPosition(start_bounds.width(),
- target_bounds.width()),
- AnimationPosition(start_bounds.height(),
- target_bounds.height())));
- }
+ if (static_cast<int>(i) != floating_index_)
+ view->SetBounds(AnimationPosition(start_bounds, target_bounds));
}
SchedulePaint();
}
@@ -226,11 +234,9 @@
target_bounds_.clear();
CalculateCellBounds(&target_bounds_);
- // And make sure the animation is running.
- if (!animation_.IsAnimating()) {
- animation_.Reset();
- animation_.Show();
- }
+ // And restart the animation.
+ animation_.Reset();
+ animation_.Show();
}
void Grid::SetViewBoundsToTarget() {
@@ -240,8 +246,3 @@
GetChildViewAt(i)->SetBounds(target_bounds_[i]);
}
}
-
-int Grid::AnimationPosition(int start, int target) {
- return start + static_cast<int>(
- static_cast<double>(target - start) * animation_.GetCurrentValue());
-}

Powered by Google App Engine
This is Rietveld 408576698