diff options
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/button/native_button.cc | 3 | ||||
-rw-r--r-- | views/controls/button/text_button.cc | 3 | ||||
-rw-r--r-- | views/controls/combobox/native_combobox_win.cc | 3 | ||||
-rw-r--r-- | views/controls/label.cc | 5 | ||||
-rw-r--r-- | views/controls/label_unittest.cc | 4 | ||||
-rw-r--r-- | views/controls/menu/menu.cc | 4 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.cc | 5 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.cc | 4 | ||||
-rw-r--r-- | views/controls/message_box_view.cc | 8 | ||||
-rw-r--r-- | views/controls/table/table_view.cc | 3 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 5 | ||||
-rw-r--r-- | views/controls/tree/tree_view.cc | 7 |
12 files changed, 30 insertions, 24 deletions
diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index 141cf328..5bdc9c73 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -10,6 +10,7 @@ #endif #include "app/l10n_util.h" +#include "base/i18n/rtl.h" #include "base/keyboard_codes.h" #include "base/logging.h" #include "views/controls/native/native_view_host.h" @@ -71,7 +72,7 @@ void NativeButton::SetLabel(const std::wstring& label) { // 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 (l10n_util::AdjustStringForLocaleDirection(label_, &localized_label)) + if (base::i18n::AdjustStringForLocaleDirection(label_, &localized_label)) label_ = localized_label; if (native_wrapper_) diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 042f9d2..ca0954d 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -7,7 +7,6 @@ #include <algorithm> #include "app/gfx/canvas.h" -#include "app/l10n_util.h" #include "app/throb_animation.h" #include "app/resource_bundle.h" #include "views/controls/button/button.h" @@ -321,7 +320,7 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { text_bounds.y(), text_bounds.width(), text_bounds.height(), - l10n_util::DefaultCanvasTextAlignment()); + gfx::Canvas::DefaultCanvasTextAlignment()); #else canvas->DrawStringInt(text_, font_, diff --git a/views/controls/combobox/native_combobox_win.cc b/views/controls/combobox/native_combobox_win.cc index 69ca8a3..c95520e 100644 --- a/views/controls/combobox/native_combobox_win.cc +++ b/views/controls/combobox/native_combobox_win.cc @@ -8,6 +8,7 @@ #include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/i18n/rtl.h" #include "gfx/native_theme_win.h" #include "views/controls/combobox/combobox.h" #include "views/widget/widget.h" @@ -52,7 +53,7 @@ void NativeComboboxWin::UpdateFromModel() { // text is displayed correctly in right-to-left UIs. std::wstring localized_text; const wchar_t* text_ptr = text.c_str(); - if (l10n_util::AdjustStringForLocaleDirection(text, &localized_text)) + if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) text_ptr = localized_text.c_str(); SendMessage(native_view(), CB_ADDSTRING, 0, diff --git a/views/controls/label.cc b/views/controls/label.cc index b3d4e41..0116b5a 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -12,6 +12,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/text_elider.h" +#include "base/i18n/rtl.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "gfx/color_utils.h" @@ -148,8 +149,8 @@ void Label::CalculateDrawStringParams(std::wstring* paint_text, // characters. We use the locale settings because an URL is always treated // as an LTR string, even if its containing view does not use an RTL UI // layout. - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) - l10n_util::WrapStringWithLTRFormatting(paint_text); + if (base::i18n::IsRTL()) + base::i18n::WrapStringWithLTRFormatting(paint_text); } else { *paint_text = text_; } diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc index 7d08595..8caabb0 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -4,6 +4,7 @@ #include "app/gfx/canvas.h" #include "app/l10n_util.h" +#include "base/i18n/rtl.h" #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #include "views/border.h" @@ -65,8 +66,7 @@ TEST(LabelTest, ColorProperty) { TEST(LabelTest, AlignmentProperty) { Label label; - bool reverse_alignment = - l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; + bool reverse_alignment = base::i18n::IsRTL(); label.SetHorizontalAlignment(Label::ALIGN_RIGHT); EXPECT_EQ( diff --git a/views/controls/menu/menu.cc b/views/controls/menu/menu.cc index 6a81d9c..479a545 100644 --- a/views/controls/menu/menu.cc +++ b/views/controls/menu/menu.cc @@ -4,13 +4,13 @@ #include "views/controls/menu/menu.h" -#include "app/l10n_util.h" +#include "base/i18n/rtl.h" #include "third_party/skia/include/core/SkBitmap.h" namespace views { bool Menu::Delegate::IsRightToLeftUILayout() const { - return l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; + return base::i18n::IsRTL(); } const SkBitmap& Menu::Delegate::GetEmptyIcon() const { diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 49f68ed..a1fd9ad 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -7,6 +7,7 @@ #include "app/gfx/canvas.h" #include "app/l10n_util.h" #include "app/os_exchange_data.h" +#include "base/i18n/rtl.h" #include "base/keyboard_codes.h" #include "base/time.h" #include "views/controls/button/menu_button.h" @@ -730,14 +731,14 @@ bool MenuController::OnKeyDown(int key_code // Handling of VK_RIGHT and VK_LEFT is different depending on the UI // layout. case base::VKEY_RIGHT: - if (l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT) + if (base::i18n::IsRTL()) CloseSubmenu(); else OpenSubmenuChangeSelectionIfCan(); break; case base::VKEY_LEFT: - if (l10n_util::TextDirection() == l10n_util::RIGHT_TO_LEFT) + if (base::i18n::IsRTL()) OpenSubmenuChangeSelectionIfCan(); else CloseSubmenu(); diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index 300ef2c6..395e9a5 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -9,8 +9,8 @@ #include <string> #include "app/gfx/font.h" -#include "app/l10n_util.h" #include "app/menus/menu_model.h" +#include "base/i18n/rtl.h" #include "base/keyboard_code_conversion_gtk.h" #include "base/keyboard_codes.h" #include "base/message_loop.h" @@ -328,7 +328,7 @@ void NativeMenuGtk::MenuPositionFunc(GtkMenu* menu, *x = position->point.x(); *y = position->point.y(); views::Menu2::Alignment alignment = position->alignment; - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { + if (base::i18n::IsRTL()) { switch (alignment) { case Menu2::ALIGN_TOPRIGHT: alignment = Menu2::ALIGN_TOPLEFT; diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index c5d8882..756919a 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -6,8 +6,8 @@ #include "app/clipboard/clipboard.h" #include "app/clipboard/scoped_clipboard_writer.h" -#include "app/l10n_util.h" #include "app/message_box_flags.h" +#include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "views/controls/button/checkbox.h" @@ -120,10 +120,10 @@ void MessageBoxView::Init(int dialog_flags, if (dialog_flags & MessageBoxFlags::kAutoDetectAlignment) { // Determine the alignment and directionality based on the first character // with strong directionality. - l10n_util::TextDirection direction = - l10n_util::GetFirstStrongCharacterDirection(message_label_->GetText()); + base::i18n::TextDirection direction = + base::i18n::GetFirstStrongCharacterDirection(message_label_->GetText()); views::Label::Alignment alignment; - if (direction == l10n_util::RIGHT_TO_LEFT) + if (direction == base::i18n::RIGHT_TO_LEFT) alignment = views::Label::ALIGN_RIGHT; else alignment = views::Label::ALIGN_LEFT; diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 6122e44..3d1acd1 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -15,6 +15,7 @@ #include "app/l10n_util_win.h" #include "app/resource_bundle.h" #include "app/table_model.h" +#include "base/i18n/rtl.h" #include "base/string_util.h" #include "base/win_util.h" #include "gfx/favicon_size.h" @@ -1131,7 +1132,7 @@ void TableView::PaintAltText() { // Pad by 1 for halo. canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, 1, bounds.width() - 2, bounds.height() - 2, - l10n_util::DefaultCanvasTextAlignment()); + gfx::Canvas::DefaultCanvasTextAlignment()); canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); ReleaseDC(GetNativeControlHWND(), dc); } diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 9f2392f..f66b949 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -11,6 +11,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/win_util.h" +#include "base/i18n/rtl.h" #include "base/keyboard_codes.h" #include "base/string_util.h" #include "base/win_util.h" @@ -131,7 +132,7 @@ void NativeTextfieldWin::UpdateText() { // 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 (!l10n_util::AdjustStringForLocaleDirection(text, &text_to_set)) + if (!base::i18n::AdjustStringForLocaleDirection(text, &text_to_set)) text_to_set = text; if (textfield_->style() & Textfield::STYLE_LOWERCASE) text_to_set = l10n_util::ToLower(text_to_set); @@ -808,7 +809,7 @@ LONG NativeTextfieldWin::ClipXCoordToVisibleText(LONG x, // paragraph. bool ltr_text_in_ltr_layout = true; if ((pf2.wEffects & PFE_RTLPARA) || - l10n_util::StringContainsStrongRTLChars(GetText())) { + base::i18n::StringContainsStrongRTLChars(GetText())) { ltr_text_in_ltr_layout = false; } const int length = GetTextLength(); diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 7cf1e8f..f70ac17 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -11,6 +11,7 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" +#include "base/i18n/rtl.h" #include "base/keyboard_codes.h" #include "base/stl_util-inl.h" #include "base/win_util.h" @@ -399,7 +400,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { // Adjust the string direction if such adjustment is required. std::wstring localized_text; - if (l10n_util::AdjustStringForLocaleDirection(text, &localized_text)) + if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) text.swap(localized_text); wcsncpy_s(info->item.pszText, info->item.cchTextMax, text.c_str(), @@ -729,7 +730,7 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, return 0; HDC dc = canvas.beginPlatformPaint(); - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { + if (base::i18n::IsRTL()) { // gfx::Canvas ends up configuring the DC with a mode of GM_ADVANCED. // For some reason a graphics mode of ADVANCED triggers all the text // to be mirrored when RTL. Set the mode back to COMPATIBLE and @@ -757,7 +758,7 @@ LRESULT CALLBACK TreeView::TreeWndProc(HWND window, -canvas.paintStruct().rcPaint.top, NULL); } SendMessage(window, WM_PRINTCLIENT, reinterpret_cast<WPARAM>(dc), 0); - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { + if (base::i18n::IsRTL()) { // Reset the origin of the dc back to 0. This way when we copy the bits // over we copy the right bits. SetViewportOrgEx(dc, 0, 0, NULL); |