diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-01 21:19:30 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-01 21:19:30 +0000 |
commit | 7cb7a312c5410b618a87e3093235de354e9a9a82 (patch) | |
tree | 4a28163ff8ac411722c95b6d8ce745ac9602e175 /chrome/browser/tab_contents | |
parent | b117bb496f7983ac8e270feea3fd479727a0a2a8 (diff) | |
download | chromium_src-7cb7a312c5410b618a87e3093235de354e9a9a82.zip chromium_src-7cb7a312c5410b618a87e3093235de354e9a9a82.tar.gz chromium_src-7cb7a312c5410b618a87e3093235de354e9a9a82.tar.bz2 |
This CL fixes issue 10827 -- Hebrew: pop-up menu positioned to right of mouse-click in content area
context menu should be positioned using the mouse-click point as top right point in RTL locales.
BUG=http://crbug.com/10827
TEST=Open Hebrew Chrome, Right-click on the content area, on a link, or on an image, The pop-up menu should be positioned to the left of the mouse-click.
Review URL: http://codereview.chromium.org/118043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu_win.cc | 14 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu_win.h | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.cc b/chrome/browser/tab_contents/render_view_context_menu_win.cc index dbb1ead..90b0345 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_win.cc @@ -14,8 +14,12 @@ RenderViewContextMenuWin::RenderViewContextMenuWin( const ContextMenuParams& params, HWND owner) : RenderViewContextMenu(tab_contents, params), - ALLOW_THIS_IN_INITIALIZER_LIST(menu_(this, views::Menu::TOPLEFT, owner)), sub_menu_(NULL) { + // anchor_position set per http://crbug.com/10827. + views::Menu::AnchorPoint anchor_position = views::Menu::TOPLEFT; + if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) + anchor_position = views::Menu::TOPRIGHT; + menu_.reset(new views::MenuWin(this, anchor_position, owner)); InitMenu(params.node); } @@ -23,7 +27,7 @@ RenderViewContextMenuWin::~RenderViewContextMenuWin() { } void RenderViewContextMenuWin::RunMenuAt(int x, int y) { - menu_.RunMenuAt(x, y); + menu_->RunMenuAt(x, y); } void RenderViewContextMenuWin::AppendMenuItem(int id) { @@ -46,7 +50,7 @@ void RenderViewContextMenuWin::AppendCheckboxMenuItem(int id, } void RenderViewContextMenuWin::AppendSeparator() { - views::Menu* menu = sub_menu_ ? sub_menu_ : &menu_; + views::Menu* menu = sub_menu_ ? sub_menu_ : menu_.get(); menu->AppendSeparator(); } @@ -55,7 +59,7 @@ void RenderViewContextMenuWin::StartSubMenu(int id, const std::wstring& label) { NOTREACHED(); return; } - sub_menu_ = menu_.AppendSubMenu(id, label); + sub_menu_ = menu_->AppendSubMenu(id, label); } void RenderViewContextMenuWin::FinishSubMenu() { @@ -67,7 +71,7 @@ void RenderViewContextMenuWin::AppendItem( int id, const std::wstring& label, views::Menu::MenuItemType type) { - views::Menu* menu = sub_menu_ ? sub_menu_ : &menu_; + views::Menu* menu = sub_menu_ ? sub_menu_ : menu_.get(); menu->AppendMenuItem(id, label, type); } diff --git a/chrome/browser/tab_contents/render_view_context_menu_win.h b/chrome/browser/tab_contents/render_view_context_menu_win.h index 5d64342..94aec65 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_win.h +++ b/chrome/browser/tab_contents/render_view_context_menu_win.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_WIN_H_ #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_WIN_H_ +#include "base/scoped_ptr.h" #include "chrome/browser/tab_contents/render_view_context_menu.h" #include "views/accelerator.h" #include "views/controls/menu/menu_win.h" @@ -43,7 +44,7 @@ class RenderViewContextMenuWin : public RenderViewContextMenu, const std::wstring& label, views::Menu::MenuItemType type); - views::MenuWin menu_; + scoped_ptr<views::MenuWin> menu_; views::Menu* sub_menu_; }; |