Index: ui/gfx/canvas_skia.cc |
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc |
index 2f9bd605ff804d1e3f7793e8193c89ad156fc76d..bf9499319bc822e8b2f2abba48e0ccc6ece3d82c 100644 |
--- a/ui/gfx/canvas_skia.cc |
+++ b/ui/gfx/canvas_skia.cc |
@@ -100,7 +100,7 @@ Range StripAcceleratorChars(int flags, base::string16* text) { |
// Elides |text| and adjusts |range| appropriately. If eliding causes |range| |
// to no longer point to the same character in |text|, |range| is made invalid. |
void ElideTextAndAdjustRange(const FontList& font_list, |
- int width, |
+ float width, |
base::string16* text, |
Range* range) { |
const base::char16 start_char = |
@@ -174,9 +174,10 @@ void Canvas::SizeStringFloat(const base::string16& text, |
else if (!(flags & NO_ELLIPSIS)) |
wrap_behavior = ELIDE_LONG_WORDS; |
- Rect rect(*width, INT_MAX); |
+ Rect rect(static_cast<int>(*width), INT_MAX); |
msw
2014/10/17 22:13:23
Hmm, it seems silly to cast float->int->float for
Peter Kasting
2014/10/21 01:20:45
Done.
|
std::vector<base::string16> strings; |
- ElideRectangleText(adjusted_text, font_list, rect.width(), rect.height(), |
+ ElideRectangleText(adjusted_text, font_list, |
+ static_cast<float>(rect.width()), rect.height(), |
wrap_behavior, &strings); |
scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |
UpdateRenderText(rect, base::string16(), font_list, flags, 0, |
@@ -198,11 +199,12 @@ void Canvas::SizeStringFloat(const base::string16& text, |
// will inexplicably fail with result E_INVALIDARG. Guard against this. |
const size_t kMaxRenderTextLength = 5000; |
if (adjusted_text.length() >= kMaxRenderTextLength) { |
- *width = font_list.GetExpectedTextWidth(adjusted_text.length()); |
- *height = font_list.GetHeight(); |
+ *width = static_cast<float>( |
+ font_list.GetExpectedTextWidth(adjusted_text.length())); |
+ *height = static_cast<float>(font_list.GetHeight()); |
} else { |
scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |
- Rect rect(*width, *height); |
+ Rect rect(static_cast<int>(*width), static_cast<int>(*height)); |
msw
2014/10/17 22:13:23
ditto nit q: DCHECK here?
|
StripAcceleratorChars(flags, &adjusted_text); |
UpdateRenderText(rect, adjusted_text, font_list, flags, 0, |
render_text.get()); |
@@ -247,7 +249,8 @@ void Canvas::DrawStringRectWithShadows(const base::string16& text, |
wrap_behavior = ELIDE_LONG_WORDS; |
std::vector<base::string16> strings; |
- ElideRectangleText(adjusted_text, font_list, text_bounds.width(), |
+ ElideRectangleText(adjusted_text, font_list, |
+ static_cast<float>(text_bounds.width()), |
text_bounds.height(), wrap_behavior, &strings); |
for (size_t i = 0; i < strings.size(); i++) { |
@@ -294,8 +297,9 @@ void Canvas::DrawStringRectWithShadows(const base::string16& text, |
#endif |
if (elide_text) { |
- ElideTextAndAdjustRange(font_list, text_bounds.width(), &adjusted_text, |
- &range); |
+ ElideTextAndAdjustRange(font_list, |
+ static_cast<float>(text_bounds.width()), |
+ &adjusted_text, &range); |
} |
UpdateRenderText(rect, adjusted_text, font_list, flags, color, |