Chromium Code Reviews| Index: ash/system/user/tray_user.cc |
| diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc |
| index e83272758273f147848c66cb83b11b77f66a634c..e8106c37efa7dcac8f5e552f4ff2ef290e6188c7 100644 |
| --- a/ash/system/user/tray_user.cc |
| +++ b/ash/system/user/tray_user.cc |
| @@ -542,7 +542,7 @@ void PublicAccountUserDetails::CalculatePreferredSize(SystemTrayItem* owner, |
| int min_width = std::max( |
| link_size.width(), |
| bubble_view->GetPreferredSize().width() - (used_width + insets.width())); |
| - int max_width = std::min( |
| + int max_width = std::min<int>( |
| font.GetStringWidth(text_) + space_width + link_size.width(), |
|
sky
2013/10/01 23:53:03
Won't this round down? It seems all to easy to acc
jianli
2013/10/02 00:49:20
Does ash use the fractional width? If not, we shou
|
| bubble_view->GetMaximumSize().width() - (used_width + insets.width())); |
| // Do a binary search for the minimum width that ensures no more than three |
| @@ -555,7 +555,7 @@ void PublicAccountUserDetails::CalculatePreferredSize(SystemTrayItem* owner, |
| lines.clear(); |
| const int width = (min_width + max_width) / 2; |
| const bool too_narrow = gfx::ElideRectangleText( |
| - text_, font, width, INT_MAX, gfx::TRUNCATE_LONG_WORDS, &lines) != 0; |
| + text_, font, width, FLT_MAX, gfx::TRUNCATE_LONG_WORDS, &lines) != 0; |
| int line_count = lines.size(); |
| if (!too_narrow && line_count == 3 && |
| width - font.GetStringWidth(lines.back()) <= |
| @@ -571,7 +571,7 @@ void PublicAccountUserDetails::CalculatePreferredSize(SystemTrayItem* owner, |
| // Calculate the corresponding height and set the preferred size. |
| lines.clear(); |
| gfx::ElideRectangleText( |
| - text_, font, min_width, INT_MAX, gfx::TRUNCATE_LONG_WORDS, &lines); |
| + text_, font, min_width, FLT_MAX, gfx::TRUNCATE_LONG_WORDS, &lines); |
| int line_count = lines.size(); |
| if (min_width - font.GetStringWidth(lines.back()) <= |
| space_width + link_size.width()) { |