diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 21:29:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 21:29:13 +0000 |
commit | 7a97c152de8d12485135a4254c9d12fc9b4f5941 (patch) | |
tree | 3b00a57e0cac512005e005066180545a03955e81 /views | |
parent | 6fbdcea0661e75df1c8a3e161cb83114c2284e8b (diff) | |
download | chromium_src-7a97c152de8d12485135a4254c9d12fc9b4f5941.zip chromium_src-7a97c152de8d12485135a4254c9d12fc9b4f5941.tar.gz chromium_src-7a97c152de8d12485135a4254c9d12fc9b4f5941.tar.bz2 |
Changes windows menu to strip out tabs in the string. Windows
interprets tabs as an accelerator. This means if the menu text has
tabs in it we get weird behavior, and possibly trigger bugs in
windows.
BUG=77151
TEST=see bug
R=ben@chromium.org
Review URL: http://codereview.chromium.org/6745002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index f639a2e..b9c78a1 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/stl_util-inl.h" +#include "base/string_util.h" #include "base/win/wrapped_window_proc.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -557,6 +558,9 @@ void NativeMenuWin::UpdateMenuItemInfoForString( const std::wstring& label) { std::wstring formatted = label; ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); + // Strip out any tabs, otherwise they get interpreted as accelerators and can + // lead to weird behavior. + ReplaceSubstringsAfterOffset(&formatted, 0, L"\t", L" "); if (type != ui::MenuModel::TYPE_SUBMENU) { // Add accelerator details to the label if provided. views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); |