Chromium Code Reviews| Index: ash/shelf/shelf_view.cc |
| diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc |
| index d59ff70ae5017f478bb676ccea6c496387cdf5de..80491d61bf48c21e8966671f6f7f27dd5f1a1877 100644 |
| --- a/ash/shelf/shelf_view.cc |
| +++ b/ash/shelf/shelf_view.cc |
| @@ -833,12 +833,23 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) const { |
| return; |
| } |
| + // IME menu icon. |
| + int last_item_index = view_model_->view_size() - 1; |
|
sky
2016/05/19 16:32:48
Might view_size be 0 at this point?
Azure Wei
2016/05/20 01:08:58
Added the check of |last_item_index|.
|
| + bool is_last_item_menu = |
| + model_->items()[last_item_index].type == TYPE_IME_MENU; |
| + if (is_last_item_menu) { |
| + x = shelf_->PrimaryAxisValue(available_size - w, 0); |
| + y = shelf_->PrimaryAxisValue(0, available_size - h); |
| + view_model_->set_ideal_bounds(last_item_index, gfx::Rect(x, y, w, h)); |
| + --last_item_index; |
| + available_size = shelf_->PrimaryAxisValue(x, y); |
| + } |
| + |
| // Right aligned icons. |
| int end_position = available_size - button_spacing; |
| x = shelf_->PrimaryAxisValue(end_position, 0); |
| y = shelf_->PrimaryAxisValue(0, end_position); |
| - for (int i = view_model_->view_size() - 1; |
| - i >= first_panel_index; --i) { |
| + for (int i = last_item_index; i >= first_panel_index; --i) { |
| x = shelf_->PrimaryAxisValue(x - w - button_spacing, x); |
| y = shelf_->PrimaryAxisValue(y, y - h - button_spacing); |
| view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h)); |