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

Unified Diff: ui/gfx/canvas.cc

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes per feedback 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/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index eb0834ba8d9ac7ed0bd166d4d6a1d420f0074b07..babb5cd543f092c711a646c84ff9d720bcfce099 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -83,27 +83,27 @@ void Canvas::RecreateBackingCanvas(const Size& size,
}
// static
-void Canvas::SizeStringInt(const base::string16& text,
- const Font& font,
- int* width,
- int* height,
- int line_height,
- int flags) {
- SizeStringInt(text, FontList(font), width, height, line_height, flags);
+void Canvas::SizeStringToFit(const base::string16& text,
+ const Font& font,
+ float* width,
+ float* height,
+ int line_height,
+ int flags) {
+ SizeStringToFit(text, FontList(font), width, height, line_height, flags);
}
// static
-int Canvas::GetStringWidth(const base::string16& text,
- const FontList& font_list) {
- int width = 0, height = 0;
- SizeStringInt(text, font_list, &width, &height, 0, NO_ELLIPSIS);
+float Canvas::GetStringWidth(const base::string16& text,
+ const FontList& font_list) {
+ float width = 0, height = 0;
+ SizeStringToFit(text, font_list, &width, &height, 0, NO_ELLIPSIS);
return width;
}
// static
-int Canvas::GetStringWidth(const base::string16& text, const Font& font) {
- int width = 0, height = 0;
- SizeStringInt(text, FontList(font), &width, &height, 0, NO_ELLIPSIS);
+float Canvas::GetStringWidth(const base::string16& text, const Font& font) {
+ float width = 0, height = 0;
+ SizeStringToFit(text, FontList(font), &width, &height, 0, NO_ELLIPSIS);
return width;
}

Powered by Google App Engine
This is Rietveld 408576698