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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 265003: Fix long tooltips flashing like crazy under Windows. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_win.cc
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_win.cc (revision 27692)
+++ chrome/browser/renderer_host/render_widget_host_view_win.cc (working copy)
@@ -626,14 +626,14 @@
}
void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) {
- if (tooltip_text != tooltip_text_) {
- tooltip_text_ = tooltip_text;
+ // Clamp the tooltip length to kMaxTooltipLength so that we don't
+ // accidentally DOS the user with a mega tooltip (since Windows doesn't seem
+ // to do this itself).
+ const std::wstring& new_tooltip_text =
+ l10n_util::TruncateString(tooltip_text, kMaxTooltipLength);
- // Clamp the tooltip length to kMaxTooltipLength so that we don't
- // accidentally DOS the user with a mega tooltip (since Windows doesn't seem
- // to do this itself).
- if (tooltip_text_.length() > kMaxTooltipLength)
- tooltip_text_ = tooltip_text_.substr(0, kMaxTooltipLength);
+ if (new_tooltip_text != tooltip_text_) {
+ tooltip_text_ = new_tooltip_text;
// Need to check if the tooltip is already showing so that we don't
// immediately show the tooltip with no delay when we move the mouse from
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698