diff options
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/button/native_button.cc | 4 | ||||
-rw-r--r-- | views/controls/combobox/native_combobox_win.cc | 6 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 10 | ||||
-rw-r--r-- | views/controls/tree/tree_view.cc | 4 |
4 files changed, 8 insertions, 16 deletions
diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index 89dae9c..e1693d3 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -74,9 +74,7 @@ void NativeButton::SetLabel(const std::wstring& label) { // In order to overcome this problem, we mark the localized Hebrew strings as // RTL strings explicitly (using the appropriate Unicode formatting) so that // Windows displays the text correctly regardless of the HWND hierarchy. - std::wstring localized_label; - if (base::i18n::AdjustStringForLocaleDirection(label_, &localized_label)) - label_ = localized_label; + base::i18n::AdjustStringForLocaleDirection(&label_); if (native_wrapper_) native_wrapper_->UpdateLabel(); diff --git a/views/controls/combobox/native_combobox_win.cc b/views/controls/combobox/native_combobox_win.cc index 720e51f..2134a75e 100644 --- a/views/controls/combobox/native_combobox_win.cc +++ b/views/controls/combobox/native_combobox_win.cc @@ -47,14 +47,12 @@ void NativeComboboxWin::UpdateFromModel() { int max_width = 0; int num_items = combobox_->model()->GetItemCount(); for (int i = 0; i < num_items; ++i) { - const std::wstring& text = UTF16ToWide(combobox_->model()->GetItemAt(i)); + std::wstring text = UTF16ToWide(combobox_->model()->GetItemAt(i)); // Inserting the Unicode formatting characters if necessary so that the // text is displayed correctly in right-to-left UIs. - std::wstring localized_text; + base::i18n::AdjustStringForLocaleDirection(&text); const wchar_t* text_ptr = text.c_str(); - if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) - text_ptr = localized_text.c_str(); SendMessage(native_view(), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(text_ptr)); diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 2109cb9..3f4b0eb 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -155,13 +155,11 @@ void NativeTextfieldWin::UpdateText() { std::wstring text = textfield_->text(); // Adjusting the string direction before setting the text in order to make // sure both RTL and LTR strings are displayed properly. - std::wstring text_to_set; - if (!base::i18n::AdjustStringForLocaleDirection(text, &text_to_set)) - text_to_set = text; + base::i18n::AdjustStringForLocaleDirection(&text); if (textfield_->style() & Textfield::STYLE_LOWERCASE) - text_to_set = l10n_util::ToLower(text_to_set); - SetWindowText(text_to_set.c_str()); - UpdateAccessibleValue(text_to_set); + text = l10n_util::ToLower(text); + SetWindowText(text.c_str()); + UpdateAccessibleValue(text); } void NativeTextfieldWin::AppendText(const string16& text) { diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 6b02a62..bfdd454 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -370,9 +370,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { DCHECK(info->item.cchTextMax); // Adjust the string direction if such adjustment is required. - std::wstring localized_text; - if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) - text.swap(localized_text); + base::i18n::AdjustStringForLocaleDirection(&text); wcsncpy_s(info->item.pszText, info->item.cchTextMax, text.c_str(), _TRUNCATE); |