diff options
author | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-21 17:05:49 +0000 |
---|---|---|
committer | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-21 17:05:49 +0000 |
commit | d2ec9af2197d396716ae15da9f1e1d27e8877b4c (patch) | |
tree | 7161075c7477772cb572a826f996e2d232736e2a /ui/gfx/skia_util.cc | |
parent | 8227d054171e22971d3688b02d02d9ad548ff12f (diff) | |
download | chromium_src-d2ec9af2197d396716ae15da9f1e1d27e8877b4c.zip chromium_src-d2ec9af2197d396716ae15da9f1e1d27e8877b4c.tar.gz chromium_src-d2ec9af2197d396716ae15da9f1e1d27e8877b4c.tar.bz2 |
Apply HIDE_PREFIX to Skia strings on linux without doubling underscores.
On linux, CanvasSkia::DrawStringInt() was removing ampersands (when
HIDE_PREFIX flag was set) with gfx::RemoveWindowsStyleAccelerators(),
which has the side effect of doubling underscores. This CL replaces the call
with code that only strips ampersands (turning doubled ampersands into
a single ampersand).
BUG=chromium-os:15823
TEST=observe network menu with SSIDs containing underscores and ampersands
Review URL: http://codereview.chromium.org/7170025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89845 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/skia_util.cc')
-rw-r--r-- | ui/gfx/skia_util.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc index 9f82b14..3b08273 100644 --- a/ui/gfx/skia_util.cc +++ b/ui/gfx/skia_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -58,4 +58,21 @@ bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2) { return (size1 == size2) && (0 == memcmp(addr1, addr2, bitmap1.getSize())); } +std::string RemoveAcceleratorChar(const std::string& s, + char accelerator_char) { + bool escaped = false; + std::string accelerator_removed; + accelerator_removed.reserve(s.size()); + for (size_t i = 0; i < s.size(); ++i) { + if (s[i] != accelerator_char || escaped) { + accelerator_removed.push_back(s[i]); + escaped = false; + } else { + escaped = true; + } + } + + return accelerator_removed; +} + } // namespace gfx |