diff options
author | dpolukhin@google.com <dpolukhin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-06 13:14:06 +0000 |
---|---|---|
committer | dpolukhin@google.com <dpolukhin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-06 13:14:06 +0000 |
commit | 45c2da24a79f39b78eeb04bdc8afe5cbed9cbbe2 (patch) | |
tree | b6b2d6a0825fce81ee7ca06f8c7022d478b5aae0 /views | |
parent | c37be45876998a04f0ec12b3c16a54d0a761da93 (diff) | |
download | chromium_src-45c2da24a79f39b78eeb04bdc8afe5cbed9cbbe2.zip chromium_src-45c2da24a79f39b78eeb04bdc8afe5cbed9cbbe2.tar.gz chromium_src-45c2da24a79f39b78eeb04bdc8afe5cbed9cbbe2.tar.bz2 |
Don't mirror menu position for RTL because on Windows we set RLT window flags and Window does it for us.
Place mirroring changes from http://codereview.chromium.org/601032 to GTK specific part.
TEST=In TRL layout check drop down menus on Windows, Linux and Chrome OS - on all platforms menu should be inside Chrome window.
BUG=36627
Review URL: http://codereview.chromium.org/660376
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/menu/menu_2.cc | 20 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.cc | 24 | ||||
-rw-r--r-- | views/controls/menu/native_menu_win.cc | 1 |
3 files changed, 22 insertions, 23 deletions
diff --git a/views/controls/menu/menu_2.cc b/views/controls/menu/menu_2.cc index 4b7829e..2228b72 100644 --- a/views/controls/menu/menu_2.cc +++ b/views/controls/menu/menu_2.cc @@ -1,6 +1,6 @@ -// 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. +// 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. #include "views/controls/menu/menu_2.h" @@ -23,20 +23,6 @@ gfx::NativeMenu Menu2::GetNativeMenu() const { } void Menu2::RunMenuAt(const gfx::Point& point, Alignment alignment) { - // On RTL systems menu alignment must be reversed. - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { - switch (alignment) { - case ALIGN_TOPRIGHT: - alignment = ALIGN_TOPLEFT; - break; - case ALIGN_TOPLEFT: - alignment = ALIGN_TOPRIGHT; - break; - default: - NOTREACHED(); - break; - } - } wrapper_->RunMenuAt(point, alignment); } diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index 693570e..138709b 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 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. +// 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. #include "views/controls/menu/native_menu_gtk.h" @@ -9,6 +9,7 @@ #include "app/gfx/font.h" #include "app/gfx/gtk_util.h" +#include "app/l10n_util.h" #include "app/menus/menu_model.h" #include "base/keyboard_code_conversion_gtk.h" #include "base/keyboard_codes.h" @@ -323,10 +324,23 @@ void NativeMenuGtk::MenuPositionFunc(GtkMenu* menu, GtkRequisition menu_req; gtk_widget_size_request(GTK_WIDGET(menu), &menu_req); - // TODO(beng): RTL *x = position->point.x(); *y = position->point.y(); - if (position->alignment == Menu2::ALIGN_TOPRIGHT) + views::Menu2::Alignment alignment = position->alignment; + if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { + switch (alignment) { + case Menu2::ALIGN_TOPRIGHT: + alignment = Menu2::ALIGN_TOPLEFT; + break; + case Menu2::ALIGN_TOPLEFT: + alignment = Menu2::ALIGN_TOPRIGHT; + break; + default: + NOTREACHED(); + break; + } + } + if (alignment == Menu2::ALIGN_TOPRIGHT) *x -= menu_req.width; // Make sure the popup fits on screen. diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index 630c7bb..75b8d4c 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -482,7 +482,6 @@ void NativeMenuWin::UpdateMenuItemInfoForString( } UINT NativeMenuWin::GetAlignmentFlags(int alignment) const { - bool rtl = l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT; UINT alignment_flags = TPM_TOPALIGN; if (alignment == Menu2::ALIGN_TOPLEFT) alignment_flags |= TPM_LEFTALIGN; |