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

Side by Side Diff: ui/views/widget/tooltip_manager.cc

Issue 22835002: Supports gfx::FontList in gfx::Canvas and ui::ElideText family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« ui/gfx/canvas_skia.cc ('K') | « ui/gfx/canvas_skia.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "ui/base/text/text_elider.h" 11 #include "ui/base/text/text_elider.h"
12 #include "ui/gfx/font.h"
12 13
13 namespace { 14 namespace {
14 15
15 // Maximum number of characters we allow in a tooltip. 16 // Maximum number of characters we allow in a tooltip.
16 const size_t kMaxTooltipLength = 1024; 17 const size_t kMaxTooltipLength = 1024;
17 18
18 // Maximum number of lines we allow in the tooltip. 19 // Maximum number of lines we allow in the tooltip.
19 const size_t kMaxLines = 6; 20 const size_t kMaxLines = 6;
20 21
21 } // namespace 22 } // namespace
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ui::ElideText(*i, font, available_width, ui::ELIDE_AT_END); 57 ui::ElideText(*i, font, available_width, ui::ELIDE_AT_END);
57 *max_width = std::max(*max_width, font.GetStringWidth(elided_text)); 58 *max_width = std::max(*max_width, font.GetStringWidth(elided_text));
58 if (!result.empty()) 59 if (!result.empty())
59 result.push_back('\n'); 60 result.push_back('\n');
60 result.append(elided_text); 61 result.append(elided_text);
61 } 62 }
62 *text = result; 63 *text = result;
63 } 64 }
64 65
65 } // namespace views 66 } // namespace views
OLDNEW
« ui/gfx/canvas_skia.cc ('K') | « ui/gfx/canvas_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698