summaryrefslogtreecommitdiffstats
path: root/ui/gfx/canvas_skia_linux.cc
diff options
context:
space:
mode:
authorrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 17:05:49 +0000
committerrhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 17:05:49 +0000
commitd2ec9af2197d396716ae15da9f1e1d27e8877b4c (patch)
tree7161075c7477772cb572a826f996e2d232736e2a /ui/gfx/canvas_skia_linux.cc
parent8227d054171e22971d3688b02d02d9ad548ff12f (diff)
downloadchromium_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/canvas_skia_linux.cc')
-rw-r--r--ui/gfx/canvas_skia_linux.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/gfx/canvas_skia_linux.cc b/ui/gfx/canvas_skia_linux.cc
index ae88c8e..430468e 100644
--- a/ui/gfx/canvas_skia_linux.cc
+++ b/ui/gfx/canvas_skia_linux.cc
@@ -16,6 +16,7 @@
#include "ui/gfx/gtk_util.h"
#include "ui/gfx/platform_font_gtk.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/skia_util.h"
namespace {
@@ -162,9 +163,14 @@ static void SetupPangoLayout(PangoLayout* layout,
kAcceleratorChar, NULL);
g_free(escaped_text);
} else if (flags & gfx::Canvas::HIDE_PREFIX) {
- // Remove the ampersand character.
- utf8 = gfx::RemoveWindowsStyleAccelerators(utf8);
- pango_layout_set_text(layout, utf8.data(), utf8.size());
+ // Remove the ampersand character. A double ampersand is output as
+ // a single ampersand.
+ DCHECK_EQ(1, g_unichar_to_utf8(kAcceleratorChar, NULL));
+ const std::string accelerator_removed =
+ gfx::RemoveAcceleratorChar(utf8, static_cast<char>(kAcceleratorChar));
+
+ pango_layout_set_text(layout,
+ accelerator_removed.data(), accelerator_removed.size());
} else {
pango_layout_set_text(layout, utf8.data(), utf8.size());
}