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

Side by Side Diff: ui/views/controls/menu/menu_runner_impl_cocoa.mm

Issue 1777653002: Prepare ui/ module for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h" 5 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h"
6 6
7 #import "ui/base/cocoa/menu_controller.h" 7 #import "ui/base/cocoa/menu_controller.h"
8 #include "ui/base/models/menu_model.h" 8 #include "ui/base/models/menu_model.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // Places a temporary, hidden NSView at |screen_bounds| within |window|. Used 35 // Places a temporary, hidden NSView at |screen_bounds| within |window|. Used
36 // with -[NSMenu popUpMenuPositioningItem:atLocation:inView:] to position the 36 // with -[NSMenu popUpMenuPositioningItem:atLocation:inView:] to position the
37 // menu for a combobox. The caller must remove the returned NSView from its 37 // menu for a combobox. The caller must remove the returned NSView from its
38 // superview when the menu is closed. 38 // superview when the menu is closed.
39 base::scoped_nsobject<NSView> CreateMenuAnchorView( 39 base::scoped_nsobject<NSView> CreateMenuAnchorView(
40 NSWindow* window, 40 NSWindow* window,
41 const gfx::Rect& screen_bounds, 41 const gfx::Rect& screen_bounds,
42 NSMenuItem* checked_item) { 42 NSMenuItem* checked_item) {
43 NSRect rect = gfx::ScreenRectToNSRect(screen_bounds); 43 NSRect rect = gfx::ScreenRectToNSRect(screen_bounds);
44 rect.origin = [window convertScreenToBase:rect.origin]; 44 rect.origin = [window convertRectFromScreen:rect].origin;
Avi (use Gerrit) 2016/03/08 20:07:54 Do rect = [window convertRectFromScreen:rect]; A
erikchen 2016/03/08 20:57:41 Done.
45 rect = [[window contentView] convertRect:rect fromView:nil]; 45 rect = [[window contentView] convertRect:rect fromView:nil];
46 46
47 // If there's no checked item (e.g. Combobox::STYLE_ACTION), NSMenu will 47 // If there's no checked item (e.g. Combobox::STYLE_ACTION), NSMenu will
48 // anchor at the top left of the frame. Action buttons should anchor below. 48 // anchor at the top left of the frame. Action buttons should anchor below.
49 if (!checked_item) { 49 if (!checked_item) {
50 rect.size.height = 0; 50 rect.size.height = 0;
51 if (base::i18n::IsRTL()) 51 if (base::i18n::IsRTL())
52 rect.origin.x += rect.size.width; 52 rect.origin.x += rect.size.width;
53 } else { 53 } else {
54 // To ensure a consistent anchoring that's vertically centered in the 54 // To ensure a consistent anchoring that's vertically centered in the
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 base::TimeDelta MenuRunnerImplCocoa::GetClosingEventTime() const { 158 base::TimeDelta MenuRunnerImplCocoa::GetClosingEventTime() const {
159 return closing_event_time_; 159 return closing_event_time_;
160 } 160 }
161 161
162 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() { 162 MenuRunnerImplCocoa::~MenuRunnerImplCocoa() {
163 } 163 }
164 164
165 } // namespace internal 165 } // namespace internal
166 } // namespace views 166 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698