diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-07 17:23:14 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-07 17:23:14 +0000 |
commit | dbba0c455f8b3f139fbfd9634d0bfba268085a33 (patch) | |
tree | 91c42ac484be649b5ed537ff1e12fc7edbe9f7fa /chrome/browser/gtk/tabs | |
parent | 4c1b6f0b5e1ce512780f5c83c245fd62dca3f3d1 (diff) | |
download | chromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.zip chromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.tar.gz chromium_src-dbba0c455f8b3f139fbfd9634d0bfba268085a33.tar.bz2 |
Adds Animation::CurrentValueBetween and gets rid of a bunch of
duplicate code.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/570055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tabs')
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 344d935..1ac295ce 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -222,21 +222,6 @@ class TabStripGtk::TabAnimation : public AnimationDelegate { &end_selected_width_); } - // Returns a value between |start| and |target| based on the current - // animation. - // TODO(sky): move this to animation. - int AnimationPosition(int start, int target) const { - return static_cast<int>(AnimationPosition(static_cast<double>(start), - static_cast<double>(target))); - } - - // Returns a value between |start| and |target| based on the current - // animation. - // TODO(sky): move this to animation. - double AnimationPosition(double start, double target) const { - return start + (target - start) * animation_.GetCurrentValue(); - } - TabStripGtk* tabstrip_; SlideAnimation animation_; @@ -355,8 +340,10 @@ class RemoveTabAnimation : public TabStripGtk::TabAnimation { if (index == index_) { // The tab(s) being removed are gradually shrunken depending on the state // of the animation. - if (tab->is_pinned()) - return AnimationPosition(TabGtk::GetPinnedWidth(), -kTabHOffset); + if (tab->is_pinned()) { + return animation_.CurrentValueBetween(TabGtk::GetPinnedWidth(), + -kTabHOffset); + } // Removed animated Tabs are never selected. double start_width = start_unselected_width_; @@ -365,7 +352,7 @@ class RemoveTabAnimation : public TabStripGtk::TabAnimation { double target_width = std::max(abs(kTabHOffset), TabGtk::GetMinimumUnselectedSize().width() + kTabHOffset); - return AnimationPosition(start_width, target_width); + return animation_.CurrentValueBetween(start_width, target_width); } if (tab->is_pinned()) @@ -486,10 +473,13 @@ class ResizeLayoutAnimation : public TabStripGtk::TabAnimation { if (tab->is_pinned()) return TabGtk::GetPinnedWidth(); - if (tab->IsSelected()) - return AnimationPosition(start_selected_width_, end_selected_width_); + if (tab->IsSelected()) { + return animation_.CurrentValueBetween(start_selected_width_, + end_selected_width_); + } - return AnimationPosition(start_unselected_width_, end_unselected_width_); + return animation_.CurrentValueBetween(start_unselected_width_, + end_unselected_width_); } private: |