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

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2685273002: Fix regression where font size too small for IME short name (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/ime_info.h" 9 #include "ash/common/system/tray/ime_info.h"
10 #include "ash/common/system/tray/system_menu_button.h" 10 #include "ash/common/system/tray/system_menu_button.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 id_label->SetText(id); 98 id_label->SetText(id);
99 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 99 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
100 const gfx::FontList& base_font_list = 100 const gfx::FontList& base_font_list =
101 rb.GetFontList(ui::ResourceBundle::MediumBoldFont); 101 rb.GetFontList(ui::ResourceBundle::MediumBoldFont);
102 id_label->SetFontList(base_font_list); 102 id_label->SetFontList(base_font_list);
103 103
104 // For IMEs whose short name are more than 2 characters (INTL, EXTD, etc.), 104 // For IMEs whose short name are more than 2 characters (INTL, EXTD, etc.),
105 // |kMenuIconSize| is not enough. The label will trigger eliding as "I..." 105 // |kMenuIconSize| is not enough. The label will trigger eliding as "I..."
106 // or "...". So we shrink the font size until it fits within the bounds. 106 // or "...". So we shrink the font size until it fits within the bounds.
107 int size_delta = -1; 107 int size_delta = -1;
108 while (id_label->GetPreferredSize().width() > kMenuIconSize && 108 while ((id_label->GetPreferredSize().width() -
109 id_label->GetInsets().width()) > kMenuIconSize &&
tdanderson 2017/02/10 16:16:45 Can you please post a screenshot to the bug of wha
Azure Wei 2017/02/13 01:07:29 Sure, attached screenshot to crbug.com/690563. Ple
tdanderson 2017/02/13 17:03:49 Thanks a lot, and sgabriel@ has signed off on this
109 size_delta >= kMinFontSizeDelta) { 110 size_delta >= kMinFontSizeDelta) {
110 id_label->SetFontList(base_font_list.DeriveWithSizeDelta(size_delta)); 111 id_label->SetFontList(base_font_list.DeriveWithSizeDelta(size_delta));
111 --size_delta; 112 --size_delta;
112 } 113 }
113 tri_view->AddView(TriView::Container::START, id_label); 114 tri_view->AddView(TriView::Container::START, id_label);
114 115
115 // The label shows the IME name. 116 // The label shows the IME name.
116 auto label_view = TrayPopupUtils::CreateDefaultLabel(); 117 auto label_view = TrayPopupUtils::CreateDefaultLabel();
117 label_view->SetText(label); 118 label_view->SetText(label);
118 TrayPopupItemStyle style( 119 TrayPopupItemStyle style(
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) 460 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view)
460 : ime_list_view_(ime_list_view) {} 461 : ime_list_view_(ime_list_view) {}
461 462
462 ImeListViewTestApi::~ImeListViewTestApi() {} 463 ImeListViewTestApi::~ImeListViewTestApi() {}
463 464
464 views::View* ImeListViewTestApi::GetToggleView() const { 465 views::View* ImeListViewTestApi::GetToggleView() const {
465 return ime_list_view_->material_keyboard_status_view_->toggle(); 466 return ime_list_view_->material_keyboard_status_view_->toggle();
466 } 467 }
467 468
468 } // namespace ash 469 } // namespace ash
OLDNEW
« 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