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

Unified Diff: ui/gfx/platform_font_pango.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 win bots Created 7 years, 3 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/gfx/platform_font_pango.cc
diff --git a/ui/gfx/platform_font_pango.cc b/ui/gfx/platform_font_pango.cc
index 0ddf363c3f733937799649d63d967b95c16e36bc..d079bc55b55024a487096efec4bc799b4d91f38d 100644
--- a/ui/gfx/platform_font_pango.cc
+++ b/ui/gfx/platform_font_pango.cc
@@ -182,17 +182,17 @@ int PlatformFontPango::GetBaseline() const {
return ascent_pixels_;
}
-int PlatformFontPango::GetAverageCharacterWidth() const {
+float PlatformFontPango::GetAverageCharacterWidth() const {
const_cast<PlatformFontPango*>(this)->InitPangoMetrics();
return SkScalarRound(average_width_pixels_);
}
-int PlatformFontPango::GetStringWidth(const base::string16& text) const {
+float PlatformFontPango::GetStringWidth(const base::string16& text) const {
return Canvas::GetStringWidth(text,
Font(const_cast<PlatformFontPango*>(this)));
}
-int PlatformFontPango::GetExpectedTextWidth(int length) const {
+float PlatformFontPango::GetExpectedTextWidth(int length) const {
double char_width = const_cast<PlatformFontPango*>(this)->GetAverageWidth();
return round(static_cast<float>(length) * char_width);
}

Powered by Google App Engine
This is Rietveld 408576698