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

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

Issue 6792036: Fixes bug in menu that would clip to menu height instead of work area. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | « no previous file | no next file » | 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/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/dragdrop/os_exchange_data.h" 10 #include "ui/base/dragdrop/os_exchange_data.h"
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 pending_state_.initial_bounds = bounds; 1010 pending_state_.initial_bounds = bounds;
1011 if (bounds.height() > 1) { 1011 if (bounds.height() > 1) {
1012 // Inset the bounds slightly, otherwise drag coordinates don't line up 1012 // Inset the bounds slightly, otherwise drag coordinates don't line up
1013 // nicely and menus close prematurely. 1013 // nicely and menus close prematurely.
1014 pending_state_.initial_bounds.Inset(0, 1); 1014 pending_state_.initial_bounds.Inset(0, 1);
1015 } 1015 }
1016 pending_state_.anchor = position; 1016 pending_state_.anchor = position;
1017 1017
1018 // Calculate the bounds of the monitor we'll show menus on. Do this once to 1018 // Calculate the bounds of the monitor we'll show menus on. Do this once to
1019 // avoid repeated system queries for the info. 1019 // avoid repeated system queries for the info.
1020 pending_state_.monitor_bounds = Screen::GetMonitorAreaNearestPoint( 1020 pending_state_.monitor_bounds = Screen::GetMonitorWorkAreaNearestPoint(
1021 bounds.origin()); 1021 bounds.origin());
1022 } 1022 }
1023 1023
1024 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { 1024 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) {
1025 DCHECK(IsBlockingRun()); 1025 DCHECK(IsBlockingRun());
1026 result_ = item; 1026 result_ = item;
1027 if (item && !menu_stack_.empty() && 1027 if (item && !menu_stack_.empty() &&
1028 !item->GetDelegate()->ShouldCloseAllMenusOnExecute(item->GetCommand())) { 1028 !item->GetDelegate()->ShouldCloseAllMenusOnExecute(item->GetCommand())) {
1029 exit_type_ = EXIT_OUTERMOST; 1029 exit_type_ = EXIT_OUTERMOST;
1030 } else { 1030 } else {
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 return; 1845 return;
1846 1846
1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1848 // it calls back to us, we aren't in a weird state. 1848 // it calls back to us, we aren't in a weird state.
1849 View* active_view = active_mouse_view_; 1849 View* active_view = active_mouse_view_;
1850 active_mouse_view_ = NULL; 1850 active_mouse_view_ = NULL;
1851 active_view->OnMouseCaptureLost(); 1851 active_view->OnMouseCaptureLost();
1852 } 1852 }
1853 1853
1854 } // namespace views 1854 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698