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

Unified Diff: ui/views/controls/menu/menu_item_view.cc

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix round-down problems Created 7 years, 2 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
Index: ui/views/controls/menu/menu_item_view.cc
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
index 2adc1ad2f176bec0bf5b18b18be43afb333395ce..f4ca16c446a559109c3224ea189b40afff68c760 100644
--- a/ui/views/controls/menu/menu_item_view.cc
+++ b/ui/views/controls/menu/menu_item_view.cc
@@ -976,12 +976,12 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() {
}
int label_start = GetLabelStartForThisItem();
- int string_width = font.GetStringWidth(title_);
+ float string_width = font.GetStringWidth(title_);
if (!subtitle_.empty())
string_width = std::max(string_width, font.GetStringWidth(subtitle_));
- dimensions.standard_width = string_width + label_start +
- item_right_margin_;
+ dimensions.standard_width = std::ceil(string_width + label_start +
+ item_right_margin_);
// Determine the length of the right-side text.
string16 minor_text = GetMinorText();
dimensions.minor_text_width =

Powered by Google App Engine
This is Rietveld 408576698