Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: views/controls/menu/menu_controller.cc

Issue 7115005: Reverse menu anchor position provided to views::MenuItemView for RTL languages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed BrowserActionOverflowMenuController. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.cc ('k') | views/controls/menu/menu_item_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/menu/menu_controller.h" 5 #include "views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1024
1025 void MenuController::UpdateInitialLocation( 1025 void MenuController::UpdateInitialLocation(
1026 const gfx::Rect& bounds, 1026 const gfx::Rect& bounds,
1027 MenuItemView::AnchorPosition position) { 1027 MenuItemView::AnchorPosition position) {
1028 pending_state_.initial_bounds = bounds; 1028 pending_state_.initial_bounds = bounds;
1029 if (bounds.height() > 1) { 1029 if (bounds.height() > 1) {
1030 // Inset the bounds slightly, otherwise drag coordinates don't line up 1030 // Inset the bounds slightly, otherwise drag coordinates don't line up
1031 // nicely and menus close prematurely. 1031 // nicely and menus close prematurely.
1032 pending_state_.initial_bounds.Inset(0, 1); 1032 pending_state_.initial_bounds.Inset(0, 1);
1033 } 1033 }
1034 pending_state_.anchor = position; 1034
1035 // Reverse anchor position for RTL languages.
1036 if (base::i18n::IsRTL()) {
1037 pending_state_.anchor = position == MenuItemView::TOPRIGHT ?
1038 MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT;
1039 } else {
1040 pending_state_.anchor = position;
1041 }
1035 1042
1036 // Calculate the bounds of the monitor we'll show menus on. Do this once to 1043 // Calculate the bounds of the monitor we'll show menus on. Do this once to
1037 // avoid repeated system queries for the info. 1044 // avoid repeated system queries for the info.
1038 pending_state_.monitor_bounds = Screen::GetMonitorWorkAreaNearestPoint( 1045 pending_state_.monitor_bounds = Screen::GetMonitorWorkAreaNearestPoint(
1039 bounds.origin()); 1046 bounds.origin());
1040 } 1047 }
1041 1048
1042 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { 1049 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) {
1043 DCHECK(IsBlockingRun()); 1050 DCHECK(IsBlockingRun());
1044 result_ = item; 1051 result_ = item;
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 return; 1882 return;
1876 1883
1877 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1884 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1878 // it calls back to us, we aren't in a weird state. 1885 // it calls back to us, we aren't in a weird state.
1879 View* active_view = active_mouse_view_; 1886 View* active_view = active_mouse_view_;
1880 active_mouse_view_ = NULL; 1887 active_mouse_view_ = NULL;
1881 active_view->OnMouseCaptureLost(); 1888 active_view->OnMouseCaptureLost();
1882 } 1889 }
1883 1890
1884 } // namespace views 1891 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.cc ('k') | views/controls/menu/menu_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698