OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/tooltip_manager.h" | 5 #include "ui/views/widget/tooltip_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 lines.resize(kMaxLines); | 45 lines.resize(kMaxLines); |
46 *line_count = static_cast<int>(lines.size()); | 46 *line_count = static_cast<int>(lines.size()); |
47 | 47 |
48 // Format each line to fit. | 48 // Format each line to fit. |
49 const gfx::FontList& font_list = GetDefaultFontList(); | 49 const gfx::FontList& font_list = GetDefaultFontList(); |
50 string16 result; | 50 string16 result; |
51 for (std::vector<string16>::iterator i = lines.begin(); i != lines.end(); | 51 for (std::vector<string16>::iterator i = lines.begin(); i != lines.end(); |
52 ++i) { | 52 ++i) { |
53 string16 elided_text = | 53 string16 elided_text = |
54 gfx::ElideText(*i, font_list, available_width, gfx::ELIDE_AT_END); | 54 gfx::ElideText(*i, font_list, available_width, gfx::ELIDE_AT_END); |
55 *max_width = std::max(*max_width, | 55 *max_width = std::max( |
56 gfx::GetStringWidth(elided_text, font_list)); | 56 *max_width, |
57 static_cast<int>(gfx::GetStringWidth(elided_text, font_list))); | |
msw
2013/09/27 21:54:48
Use std::max<int> instead (or float if that's more
jianli
2013/10/01 00:32:58
Done.
| |
57 if (!result.empty()) | 58 if (!result.empty()) |
58 result.push_back('\n'); | 59 result.push_back('\n'); |
59 result.append(elided_text); | 60 result.append(elided_text); |
60 } | 61 } |
61 *text = result; | 62 *text = result; |
62 } | 63 } |
63 | 64 |
64 } // namespace views | 65 } // namespace views |
OLD | NEW |