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

Unified Diff: ui/views/controls/combobox/combobox.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/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index a2afe7004be8b490512e075c59115c2fd00feaf7..6aa6e007c6f47cf29dacffc06e5379dee51df868 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -4,6 +4,8 @@
#include "ui/views/controls/combobox/combobox.h"
+#include <cmath>
+
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "grit/ui_resources.h"
@@ -334,7 +336,7 @@ void Combobox::OnModelChanged() {
}
void Combobox::UpdateFromModel() {
- int max_width = 0;
+ float max_width = 0;
const gfx::Font& font = Combobox::GetFont();
MenuItemView* menu = new MenuItemView(this);
@@ -358,7 +360,7 @@ void Combobox::UpdateFromModel() {
max_width = std::max(max_width, font.GetStringWidth(text));
}
- content_size_.SetSize(max_width, font.GetHeight());
+ content_size_.SetSize(std::ceil(max_width), font.GetHeight());
}
void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const {

Powered by Google App Engine
This is Rietveld 408576698