summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 23:15:21 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 23:15:21 +0000
commitc2f4bdb7deec2fe9aaa3583ff2066e634001be8f (patch)
treee1ba425190c39667910ff1c864bdee6afc4bd191 /views/controls
parent6e76d8d105739f3b40274dd0247a75ea44e46a89 (diff)
downloadchromium_src-c2f4bdb7deec2fe9aaa3583ff2066e634001be8f.zip
chromium_src-c2f4bdb7deec2fe9aaa3583ff2066e634001be8f.tar.gz
chromium_src-c2f4bdb7deec2fe9aaa3583ff2066e634001be8f.tar.bz2
Eliminate View::UILayoutIsRightToLeft() to standardize on base::i18n::IsRTL(). Was only needed for EnableUIMirroringForRTLLanguages(), which was only used by Views::Label, which already had this capability via set_rtl_alignment_mode().
BUG=none TEST=none Review URL: http://codereview.chromium.org/1991002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/button_dropdown.cc2
-rw-r--r--views/controls/button/menu_button.cc4
-rw-r--r--views/controls/image_view.cc2
-rw-r--r--views/controls/label.cc2
-rw-r--r--views/controls/label_unittest.cc6
-rw-r--r--views/controls/menu/menu_controller.cc2
-rw-r--r--views/controls/menu/menu_item_view.cc2
-rw-r--r--views/controls/menu/menu_item_view_win.cc4
-rw-r--r--views/controls/native_control.cc4
-rw-r--r--views/controls/native_control_win.cc4
-rw-r--r--views/controls/resize_gripper.cc2
-rw-r--r--views/controls/single_split_view.cc4
-rw-r--r--views/controls/tabbed_pane/native_tabbed_pane_win.cc6
-rw-r--r--views/controls/table/native_table_win.cc2
-rw-r--r--views/controls/table/table_view.cc4
-rw-r--r--views/controls/tree/tree_view.cc6
16 files changed, 27 insertions, 29 deletions
diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc
index 2d3f30e..7b2b3d0 100644
--- a/views/controls/button/button_dropdown.cc
+++ b/views/controls/button/button_dropdown.cc
@@ -134,7 +134,7 @@ void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) {
// is right-to-left.
gfx::Point menu_position(lb.origin());
menu_position.Offset(0, lb.height() - 1);
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
menu_position.Offset(lb.width() - 1, 0);
View::ConvertPointToScreen(this, &menu_position);
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index b45c2ac..b515e17 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -125,11 +125,11 @@ bool MenuButton::Activate() {
// The position of the menu depends on whether or not the locale is
// right-to-left.
gfx::Point menu_position(lb.right(), lb.bottom());
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
menu_position.set_x(lb.x());
View::ConvertPointToScreen(this, &menu_position);
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
menu_position.Offset(2, -4);
else
menu_position.Offset(-2, -4);
diff --git a/views/controls/image_view.cc b/views/controls/image_view.cc
index 9728332..fe6ad38 100644
--- a/views/controls/image_view.cc
+++ b/views/controls/image_view.cc
@@ -80,7 +80,7 @@ gfx::Point ImageView::ComputeImageOrigin(const gfx::Size& image_size) const {
// horizontal alignment is set to trailing, then we'll use left alignment for
// the image instead of right alignment if the UI layout is RTL.
Alignment actual_horiz_alignment = horiz_alignment_;
- if (UILayoutIsRightToLeft() && (horiz_alignment_ != CENTER))
+ if (base::i18n::IsRTL() && (horiz_alignment_ != CENTER))
actual_horiz_alignment = (horiz_alignment_ == LEADING) ? TRAILING : LEADING;
switch (actual_horiz_alignment) {
case LEADING: x = insets.left(); break;
diff --git a/views/controls/label.cc b/views/controls/label.cc
index 2aff154..9ab4e36 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -135,7 +135,7 @@ void Label::SetHorizontalAlignment(Alignment a) {
// If the View's UI layout is right-to-left and rtl_alignment_mode_ is
// USE_UI_ALIGNMENT, we need to flip the alignment so that the alignment
// settings take into account the text directionality.
- if (UILayoutIsRightToLeft() && (rtl_alignment_mode_ == USE_UI_ALIGNMENT) &&
+ if (base::i18n::IsRTL() && (rtl_alignment_mode_ == USE_UI_ALIGNMENT) &&
(a != ALIGN_CENTER))
a = (a == ALIGN_LEFT) ? ALIGN_RIGHT : ALIGN_LEFT;
if (horiz_alignment_ != a) {
diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc
index 19751ca..d238cb3 100644
--- a/views/controls/label_unittest.cc
+++ b/views/controls/label_unittest.cc
@@ -287,7 +287,7 @@ TEST(LabelTest, DrawSingleLineString) {
// Turn off mirroring so that we don't need to figure out if
// align right really means align left.
- label.EnableUIMirroringForRTLLanguages(false);
+ label.set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT);
std::wstring test_text(L"Here's a string with no returns.");
label.SetText(test_text);
@@ -405,7 +405,7 @@ TEST(LabelTest, DrawMultiLineString) {
// Turn off mirroring so that we don't need to figure out if
// align right really means align left.
- label.EnableUIMirroringForRTLLanguages(false);
+ label.set_rtl_alignment_mode(Label::AUTO_DETECT_ALIGNMENT);
std::wstring test_text(L"Another string\nwith returns\n\n!");
label.SetText(test_text);
@@ -550,7 +550,6 @@ TEST(LabelTest, DrawSingleLineStringInRTL) {
Label label;
label.SetFocusable(false);
- label.EnableUIMirroringForRTLLanguages(true);
std::string locale = l10n_util::GetApplicationLocale(std::wstring());
base::i18n::SetICUDefaultLocale("he");
@@ -673,7 +672,6 @@ TEST(LabelTest, DrawMultiLineStringInRTL) {
label.SetFocusable(false);
// Test for RTL.
- label.EnableUIMirroringForRTLLanguages(true);
std::string locale = l10n_util::GetApplicationLocale(std::wstring());
base::i18n::SetICUDefaultLocale("he");
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index a89aa8c..9005fd6 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -1264,7 +1264,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
// We must make sure we take into account the UI layout. If the layout is
// RTL, then a 'leading' menu is positioned to the left of the parent menu
// item and not to the right.
- bool layout_is_rtl = item->UILayoutIsRightToLeft();
+ bool layout_is_rtl = base::i18n::IsRTL();
bool create_on_the_right = (prefer_leading && !layout_is_rtl) ||
(!prefer_leading && layout_is_rtl);
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 64b8270..29864b2 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -386,7 +386,7 @@ void MenuItemView::PrepareForRun(bool has_mnemonics) {
int MenuItemView::GetDrawStringFlags() {
int flags = 0;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
else
flags |= gfx::Canvas::TEXT_ALIGN_LEFT;
diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc
index 489fe90..cb956cb 100644
--- a/views/controls/menu/menu_item_view_win.cc
+++ b/views/controls/menu/menu_item_view_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -134,7 +134,7 @@ void MenuItemView::Paint(gfx::Canvas* canvas, bool for_drag) {
// locale is RTL) then we should make sure the menu arrow points to the
// right direction.
NativeTheme::MenuArrowDirection arrow_direction;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
arrow_direction = NativeTheme::LEFT_POINTING_ARROW;
else
arrow_direction = NativeTheme::RIGHT_POINTING_ARROW;
diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc
index 347406f..f714382 100644
--- a/views/controls/native_control.cc
+++ b/views/controls/native_control.cc
@@ -330,7 +330,7 @@ DWORD NativeControl::GetAdditionalExStyle() const {
// extended window style for a right-to-left layout so the subclass creates
// a mirrored HWND for the underlying control.
DWORD ex_style = 0;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
ex_style |= l10n_util::GetExtendedStyles();
return ex_style;
@@ -341,7 +341,7 @@ DWORD NativeControl::GetAdditionalRTLStyle() const {
// extended window style for a right-to-left layout so the subclass creates
// a mirrored HWND for the underlying control.
DWORD ex_style = 0;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
ex_style |= l10n_util::GetExtendedTooltipStyles();
return ex_style;
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc
index baa5a19..c73d17c 100644
--- a/views/controls/native_control_win.cc
+++ b/views/controls/native_control_win.cc
@@ -134,7 +134,7 @@ DWORD NativeControlWin::GetAdditionalExStyle() const {
// extended window style for a right-to-left layout so the subclass creates
// a mirrored HWND for the underlying control.
DWORD ex_style = 0;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
ex_style |= l10n_util::GetExtendedStyles();
return ex_style;
@@ -145,7 +145,7 @@ DWORD NativeControlWin::GetAdditionalRTLStyle() const {
// extended window style for a right-to-left layout so the subclass creates
// a mirrored HWND for the underlying control.
DWORD ex_style = 0;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
ex_style |= l10n_util::GetExtendedTooltipStyles();
return ex_style;
diff --git a/views/controls/resize_gripper.cc b/views/controls/resize_gripper.cc
index 1a49957..4d6d93b 100644
--- a/views/controls/resize_gripper.cc
+++ b/views/controls/resize_gripper.cc
@@ -87,7 +87,7 @@ void ResizeGripper::ReportResizeAmount(int resize_amount, bool last_update) {
View::ConvertPointToScreen(this, &point);
resize_amount = point.x() - initial_position_;
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
resize_amount = -1 * resize_amount;
delegate_->OnResize(resize_amount, last_update);
}
diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc
index f76acb3..298a540 100644
--- a/views/controls/single_split_view.cc
+++ b/views/controls/single_split_view.cc
@@ -151,7 +151,7 @@ bool SingleSplitView::OnMouseDragged(const MouseEvent& event) {
int delta_offset = GetPrimaryAxisSize(event.x(), event.y()) -
drag_info_.initial_mouse_offset;
- if (is_horizontal_ && UILayoutIsRightToLeft())
+ if (is_horizontal_ && base::i18n::IsRTL())
delta_offset *= -1;
// Honor the minimum size when resizing.
gfx::Size min = GetChildViewAt(0)->GetMinimumSize();
@@ -188,7 +188,7 @@ bool SingleSplitView::IsPointInDivider(const gfx::Point& p) {
int divider_relative_offset;
if (is_horizontal_) {
divider_relative_offset =
- p.x() - GetChildViewAt(UILayoutIsRightToLeft() ? 1 : 0)->width();
+ p.x() - GetChildViewAt(base::i18n::IsRTL() ? 1 : 0)->width();
} else {
divider_relative_offset = p.y() - GetChildViewAt(0)->height();
}
diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
index 26579f9..87f2ebb 100644
--- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc
+++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -107,7 +107,7 @@ void NativeTabbedPaneWin::AddNativeTab(int index,
// If the locale is RTL, we set the TCIF_RTLREADING so that BiDi text is
// rendered properly on the tabs.
- if (UILayoutIsRightToLeft()) {
+ if (base::i18n::IsRTL()) {
tcitem.mask |= TCIF_RTLREADING;
}
@@ -222,7 +222,7 @@ void NativeTabbedPaneWin::CreateNativeControl() {
// Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above
// for a thorough explanation regarding why we waited until |content_window_|
// if created before we set this property for the tabbed pane's HWND).
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
l10n_util::HWNDSetRTLLayout(tab_control);
RootView* root_view = content_window_->GetRootView();
diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc
index 22ca250..d34856f 100644
--- a/views/controls/table/native_table_win.cc
+++ b/views/controls/table/native_table_win.cc
@@ -670,7 +670,7 @@ LRESULT CALLBACK NativeTableWin::TableWndProc(HWND window,
//
// As a work around this uses the position of the cursor and ignores
// the position supplied in the l_param.
- if (table->UILayoutIsRightToLeft() &&
+ if (base::i18n::IsRTL() &&
(GET_X_LPARAM(l_param) != -1 || GET_Y_LPARAM(l_param) != -1)) {
POINT screen_point;
GetCursorPos(&screen_point);
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index c1d07d9..b165ba4 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -493,7 +493,7 @@ gfx::Point TableView::GetKeyboardContextMenuLocation() {
}
}
gfx::Point screen_loc(0, y);
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
screen_loc.set_x(width());
ConvertPointToScreen(this, &screen_loc);
return screen_loc;
@@ -538,7 +538,7 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window,
//
// As a work around this uses the position of the cursor and ignores
// the position supplied in the l_param.
- if (table_view->UILayoutIsRightToLeft() &&
+ if (base::i18n::IsRTL() &&
(GET_X_LPARAM(l_param) != -1 || GET_Y_LPARAM(l_param) != -1)) {
POINT screen_point;
GetCursorPos(&screen_point);
diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc
index e5587b9..b544abc 100644
--- a/views/controls/tree/tree_view.cc
+++ b/views/controls/tree/tree_view.cc
@@ -64,7 +64,7 @@ bool TreeView::GetAccessibleRole(AccessibilityTypes::Role* role) {
bool TreeView::GetAccessibleState(AccessibilityTypes::State* state) {
DCHECK(state);
-
+
*state = AccessibilityTypes::STATE_READONLY;
return true;
}
@@ -357,7 +357,7 @@ gfx::Point TreeView::GetKeyboardContextMenuLocation() {
}
}
gfx::Point screen_loc(0, y);
- if (UILayoutIsRightToLeft())
+ if (base::i18n::IsRTL())
screen_loc.set_x(width());
ConvertPointToScreen(this, &screen_loc);
return screen_loc;
@@ -656,7 +656,7 @@ HIMAGELIST TreeView::CreateImageList() {
std::vector<SkBitmap> model_images;
model_->GetIcons(&model_images);
- bool rtl = UILayoutIsRightToLeft();
+ bool rtl = base::i18n::IsRTL();
// Creates the default image list used for trees.
SkBitmap* closed_icon =
ResourceBundle::GetSharedInstance().GetBitmapNamed(