diff options
author | simon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 09:29:51 +0000 |
---|---|---|
committer | simon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 09:29:51 +0000 |
commit | 1b124217a3111672c09cc53e6758da61e9d7dfea (patch) | |
tree | 5b9edaf112348c86e998e4b2ec2cda1f607ab8b0 /ash/launcher | |
parent | 287aa1df64b681221263110349ca12f8e7009e5d (diff) | |
download | chromium_src-1b124217a3111672c09cc53e6758da61e9d7dfea.zip chromium_src-1b124217a3111672c09cc53e6758da61e9d7dfea.tar.gz chromium_src-1b124217a3111672c09cc53e6758da61e9d7dfea.tar.bz2 |
[ash] Enable passing NULL parameter to LauncherView::CalculateIdealBounds()
Sometimes, we don't need to fetch overflow bounds.
R=jamescook@chromium.org
BUG=NONE
TEST=Compiles
Review URL: https://codereview.chromium.org/26695003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher')
-rw-r--r-- | ash/launcher/launcher_view.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index d723c09..ea0bb4e 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -793,9 +793,11 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) { else end_position = std::max(end_position, reserved_icon_space); - bounds->overflow_bounds.set_size(gfx::Size( - shelf->PrimaryAxisValue(w, width()), - shelf->PrimaryAxisValue(height(), h))); + if (bounds) { + bounds->overflow_bounds.set_size(gfx::Size( + shelf->PrimaryAxisValue(w, width()), + shelf->PrimaryAxisValue(height(), h))); + } if (ash::switches::UseAlternateShelfLayout()) last_visible_index_ = DetermineLastVisibleIndex( end_position - button_size); @@ -842,8 +844,10 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) { for (int i = first_panel_index; i <= last_hidden_index_; ++i) view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h)); - bounds->overflow_bounds.set_x(x); - bounds->overflow_bounds.set_y(y); + if (bounds) { + bounds->overflow_bounds.set_x(x); + bounds->overflow_bounds.set_y(y); + } if (!ash::switches::UseAlternateShelfLayout()) { // Position app list after overflow button. gfx::Rect app_list_bounds = view_model_->ideal_bounds(last_button_index); @@ -1346,8 +1350,7 @@ int LauncherView::CancelDrag(int modified_index) { } gfx::Size LauncherView::GetPreferredSize() { - IdealBounds ideal_bounds; - CalculateIdealBounds(&ideal_bounds); + CalculateIdealBounds(NULL); ShelfLayoutManager* shelf = tooltip_->shelf_layout_manager(); const int preferred_size = shelf->GetPreferredShelfSize(); @@ -1410,8 +1413,7 @@ void LauncherView::LauncherItemAdded(int model_index) { // button before this animation completes it doesn't appear at some random // spot (because it was in the middle of animating from 0,0 0x0 to its // target). - IdealBounds ideal_bounds; - CalculateIdealBounds(&ideal_bounds); + CalculateIdealBounds(NULL); view->SetBoundsRect(view_model_->ideal_bounds(model_index)); // The first animation moves all the views to their target position. |view| |