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

Unified Diff: ui/gfx/canvas_skia.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 per feedbacks 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/gfx/canvas_skia.cc
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
index b6830d556c6be7b56242e9ef3f100391bb352805..e349ae71a2db626fd8fbe78909b463abe142e55c 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -167,11 +167,11 @@ int AdjustPlatformSpecificFlags(const base::string16& text, int flags) {
} // namespace
// static
-void Canvas::SizeStringInt(const base::string16& text,
- const FontList& font_list,
- int* width, int* height,
- int line_height,
- int flags) {
+void Canvas::SizeStringFloat(const base::string16& text,
+ const FontList& font_list,
+ float* width, float* height,
+ int line_height,
+ int flags) {
DCHECK_GE(*width, 0);
DCHECK_GE(*height, 0);
@@ -198,12 +198,12 @@ void Canvas::SizeStringInt(const base::string16& text,
UpdateRenderText(rect, base::string16(), font_list, flags, 0,
render_text.get());
- int h = 0;
- int w = 0;
+ float h = 0;
+ float w = 0;
for (size_t i = 0; i < strings.size(); ++i) {
StripAcceleratorChars(flags, &strings[i]);
render_text->SetText(strings[i]);
- const Size& string_size = render_text->GetStringSize();
+ const SizeF& string_size = render_text->GetStringSizeF();
w = std::max(w, string_size.width());
h += (i > 0 && line_height > 0) ? line_height : string_size.height();
}
@@ -222,7 +222,7 @@ void Canvas::SizeStringInt(const base::string16& text,
StripAcceleratorChars(flags, &adjusted_text);
UpdateRenderText(rect, adjusted_text, font_list, flags, 0,
render_text.get());
- const Size& string_size = render_text->GetStringSize();
+ const SizeF& string_size = render_text->GetStringSizeF();
*width = string_size.width();
*height = string_size.height();
}

Powered by Google App Engine
This is Rietveld 408576698