summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 15:16:04 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 15:16:04 +0000
commitb22558a183cefa554a1730188a51994504100351 (patch)
tree1761e4f23e2e9060ff7bfa5a9026a4937d73e312 /views/controls
parent3f891cf79f72f4768a15bfae051e08b9211ed8c3 (diff)
downloadchromium_src-b22558a183cefa554a1730188a51994504100351.zip
chromium_src-b22558a183cefa554a1730188a51994504100351.tar.gz
chromium_src-b22558a183cefa554a1730188a51994504100351.tar.bz2
Revert 71167 - Remove wstring from gfx.
BUG=68882 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6121004 TBR=avi@chromium.org Review URL: http://codereview.chromium.org/6134010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/text_button.cc6
-rw-r--r--views/controls/label.cc2
-rw-r--r--views/controls/label_unittest.cc18
-rw-r--r--views/controls/menu/menu_item_view.cc2
-rw-r--r--views/controls/menu/menu_item_view_gtk.cc2
-rw-r--r--views/controls/textfield/gtk_views_entry.cc2
-rw-r--r--views/controls/textfield/gtk_views_textview.cc2
-rw-r--r--views/controls/textfield/native_textfield_views.cc10
8 files changed, 23 insertions, 21 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 470d97c..63eeb0e 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -360,7 +360,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
text_bounds.y(), text_bounds.width(), text_bounds.height(),
draw_string_flags);
#else
- canvas->DrawStringInt(text_,
+ canvas->DrawStringInt(UTF16ToWideHack(text_),
font_,
text_color,
text_bounds.x(),
@@ -371,11 +371,11 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) {
#endif
} else if (has_text_halo_) {
canvas->AsCanvasSkia()->DrawStringWithHalo(
- text_, font_, text_color, text_halo_color_,
+ UTF16ToWideHack(text_), font_, text_color, text_halo_color_,
text_bounds.x(), text_bounds.y(), text_bounds.width(),
text_bounds.height(), draw_string_flags);
} else {
- canvas->DrawStringInt(text_,
+ canvas->DrawStringInt(UTF16ToWideHack(text_),
font_,
text_color,
text_bounds.x(),
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 8692622..d4bf9f7 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -271,7 +271,7 @@ void Label::PaintText(gfx::Canvas* canvas,
const std::wstring& text,
const gfx::Rect& text_bounds,
int flags) {
- canvas->DrawStringInt(WideToUTF16Hack(text), font_, color_,
+ canvas->DrawStringInt(text, font_, color_,
text_bounds.x(), text_bounds.y(),
text_bounds.width(), text_bounds.height(), flags);
diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc
index 504861e..267d260 100644
--- a/views/controls/label_unittest.cc
+++ b/views/controls/label_unittest.cc
@@ -15,22 +15,22 @@ namespace views {
// All text sizing measurements (width and height) should be greater than this.
const int kMinTextDimension = 4;
-#if defined(OS_WIN)
+#if defined(WIN_OS)
// Courier is failing on linux because it's non scalable.
TEST(LabelTest, FontPropertyCourier) {
Label label;
- string16 font_name(ASCIIToUTF16("courier"));
- gfx::Font font(font_name, 30);
+ std::wstring font_name(L"courier");
+ gfx::Font font = gfx::Font::CreateFont(font_name, 30);
label.SetFont(font);
gfx::Font font_used = label.font();
- EXPECT_EQ(font_name, font_used.GetFontName());
- EXPECT_EQ(30, font_used.GetFontSize());
+ EXPECT_EQ(font_name, font_used.FontName());
+ EXPECT_EQ(30, font_used.FontSize());
}
#endif
TEST(LabelTest, FontPropertyArial) {
Label label;
- string16 font_name(ASCIIToUTF16("arial"));
+ std::wstring font_name(L"arial");
gfx::Font font(font_name, 30);
label.SetFont(font);
gfx::Font font_used = label.font();
@@ -214,7 +214,7 @@ TEST(LabelTest, MultiLineSizing) {
// SizeToFit with limited width.
label.SizeToFit(required_width - 1);
int constrained_width = label.GetLocalBounds(true).width();
-#if defined(OS_WIN)
+#if defined(WIN_OS)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_LT(constrained_width, required_width);
@@ -229,7 +229,7 @@ TEST(LabelTest, MultiLineSizing) {
int required_height = label.GetHeightForWidth(required_width);
EXPECT_GT(required_height, kMinTextDimension);
int height_for_constrained_width = label.GetHeightForWidth(constrained_width);
-#if defined(OS_WIN)
+#if defined(WIN_OS)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_GT(height_for_constrained_width, required_height);
@@ -261,7 +261,7 @@ TEST(LabelTest, MultiLineSizing) {
// calculation. If it is, then the height will grow when width
// is shrunk.
int height1 = label.GetHeightForWidth(required_width_with_border - 1);
-#if defined(OS_WIN)
+#if defined(WIN_OS)
// Canvas::SizeStringInt (in app/gfx/canvas_linux.cc)
// has to be fixed to return the size that fits to given width/height.
EXPECT_GT(height1, required_height_with_border);
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 8d2b84d..e2359d7 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -613,7 +613,7 @@ void MenuItemView::PaintAccelerator(gfx::Canvas* canvas) {
else
flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
canvas->DrawStringInt(
- accel_text, font, TextButton::kDisabledColor,
+ UTF16ToWideHack(accel_text), font, TextButton::kDisabledColor,
accel_bounds.x(), accel_bounds.y(), accel_bounds.width(),
accel_bounds.height(), flags);
}
diff --git a/views/controls/menu/menu_item_view_gtk.cc b/views/controls/menu/menu_item_view_gtk.cc
index 8c1d1ee..ab4c5315 100644
--- a/views/controls/menu/menu_item_view_gtk.cc
+++ b/views/controls/menu/menu_item_view_gtk.cc
@@ -91,7 +91,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
(available_height - font.GetHeight()) / 2, width,
font.GetHeight());
text_bounds.set_x(MirroredLeftPointForRect(text_bounds));
- canvas->DrawStringInt(WideToUTF16Hack(GetTitle()), font, fg_color,
+ canvas->DrawStringInt(GetTitle(), font, fg_color,
text_bounds.x(), text_bounds.y(), text_bounds.width(),
text_bounds.height(),
GetRootMenuItem()->GetDrawStringFlags());
diff --git a/views/controls/textfield/gtk_views_entry.cc b/views/controls/textfield/gtk_views_entry.cc
index 9a2628b..c8e03ce 100644
--- a/views/controls/textfield/gtk_views_entry.cc
+++ b/views/controls/textfield/gtk_views_entry.cc
@@ -45,7 +45,7 @@ static gint gtk_views_entry_expose_event(GtkWidget *widget,
gfx::Font font = host->textfield()->font();
const string16 text = host->textfield()->text_to_display_when_empty();
canvas.DrawStringInt(
- text, font,
+ UTF16ToWide(text), font,
gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
insets.left(), insets.top(),
widget->allocation.width - insets.width(), font.GetHeight());
diff --git a/views/controls/textfield/gtk_views_textview.cc b/views/controls/textfield/gtk_views_textview.cc
index a2cc19f..b7ec107 100644
--- a/views/controls/textfield/gtk_views_textview.cc
+++ b/views/controls/textfield/gtk_views_textview.cc
@@ -50,7 +50,7 @@ static gint gtk_views_textview_expose_event(GtkWidget *widget,
gfx::Font font = host->textfield()->font();
const string16 text = host->textfield()->text_to_display_when_empty();
canvas.DrawStringInt(
- text, font,
+ UTF16ToWide(text), font,
gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
insets.left(), insets.top(),
widget->allocation.width - insets.width(), font.GetHeight());
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index ceb5325..923de0c 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -404,11 +404,13 @@ void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
if ((*iter).selected) {
canvas->FillRectInt(selection_color, x_offset, y, width, text_height);
- canvas->DrawStringInt(text, GetFont(), kSelectedTextColor,
- x_offset, y, width, text_height);
+ canvas->DrawStringInt(
+ UTF16ToWide(text), GetFont(), kSelectedTextColor,
+ x_offset, y, width, text_height);
} else {
- canvas->DrawStringInt(text, GetFont(), text_color,
- x_offset, y, width, text_height);
+ canvas->DrawStringInt(
+ UTF16ToWide(text), GetFont(), text_color,
+ x_offset, y, width, text_height);
}
x_offset += width;
}