summaryrefslogtreecommitdiffstats
path: root/gfx/canvas_skia_linux.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/canvas_skia_linux.cc')
-rw-r--r--gfx/canvas_skia_linux.cc33
1 files changed, 2 insertions, 31 deletions
diff --git a/gfx/canvas_skia_linux.cc b/gfx/canvas_skia_linux.cc
index 7c8c6c7..d63f9b4 100644
--- a/gfx/canvas_skia_linux.cc
+++ b/gfx/canvas_skia_linux.cc
@@ -10,6 +10,7 @@
#include <pango/pangocairo.h>
#include "base/logging.h"
+#include "base/gtk_util.h"
#include "base/utf_string_conversions.h"
#include "gfx/font.h"
#include "gfx/gtk_util.h"
@@ -87,36 +88,6 @@ static void UpdateCairoFontOptions() {
g_free(rgba_style);
}
-// TODO(sky): this is a copy of the one in gtk_util. It needs to be moved to a
-// common place.
-// Common implementation of ConvertAcceleratorsFromWindowsStyle() and
-// RemoveWindowsStyleAccelerators().
-// Replaces all ampersands (as used in our grd files to indicate mnemonics)
-// to |target|. Similarly any underscores get replaced with two underscores as
-// is needed by pango.
-std::string ConvertAmperstandsTo(const std::string& label,
- const std::string& target) {
- std::string ret;
- ret.reserve(label.length() * 2);
- for (size_t i = 0; i < label.length(); ++i) {
- if ('_' == label[i]) {
- ret.push_back('_');
- ret.push_back('_');
- } else if ('&' == label[i]) {
- if (i + 1 < label.length() && '&' == label[i + 1]) {
- ret.push_back('&');
- ++i;
- } else {
- ret.append(target);
- }
- } else {
- ret.push_back(label[i]);
- }
- }
-
- return ret;
-}
-
} // namespace
namespace gfx {
@@ -194,7 +165,7 @@ static void SetupPangoLayout(PangoLayout* layout,
g_free(escaped_text);
} else if (flags & gfx::Canvas::HIDE_PREFIX) {
// Remove the ampersand character.
- utf8 = ConvertAmperstandsTo(utf8, "");
+ utf8 = gtk_util::RemoveWindowsStyleAccelerators(utf8);
pango_layout_set_text(layout, utf8.data(), utf8.size());
} else {
pango_layout_set_text(layout, utf8.data(), utf8.size());