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

Unified Diff: ash/shelf/shelf_view.cc

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check the valid of |last_item_index|. Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index d59ff70ae5017f478bb676ccea6c496387cdf5de..bca28a97861ff024091335ae313d790263adcad1 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -833,12 +833,24 @@ void ShelfView::CalculateIdealBounds(IdealBounds* bounds) const {
return;
}
+ // IME menu icon.
sky 2016/05/20 16:23:39 This comment isn't helpful. It should describe wha
Azure Wei 2016/05/24 07:21:16 Updated.
+ int last_item_index = view_model_->view_size() - 1;
+ bool is_last_item_menu =
sky 2016/05/20 16:23:39 is_last_item_ime_menu
Azure Wei 2016/05/24 07:21:16 Done.
+ (last_item_index >= 0) &&
+ (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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698