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

Side by Side Diff: ui/views/controls/menu/menu_host.cc

Issue 12041085: Fix menu corners: the menu background was being painted as a rect when in fact, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_host.h" 5 #include "ui/views/controls/menu/menu_host.h"
6 6
7 #include "ui/gfx/path.h" 7 #include "ui/gfx/path.h"
8 #include "ui/native_theme/native_theme.h" 8 #include "ui/native_theme/native_theme.h"
9 #include "ui/views/controls/menu/menu_controller.h" 9 #include "ui/views/controls/menu/menu_controller.h"
10 #include "ui/views/controls/menu/menu_host_root_view.h" 10 #include "ui/views/controls/menu/menu_host_root_view.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 void MenuHost::InitMenuHost(Widget* parent, 31 void MenuHost::InitMenuHost(Widget* parent,
32 const gfx::Rect& bounds, 32 const gfx::Rect& bounds,
33 View* contents_view, 33 View* contents_view,
34 bool do_capture) { 34 bool do_capture) {
35 Widget::InitParams params(Widget::InitParams::TYPE_MENU); 35 Widget::InitParams params(Widget::InitParams::TYPE_MENU);
36 params.has_dropshadow = true; 36 params.has_dropshadow = true;
37 params.parent = parent ? parent->GetNativeView() : NULL; 37 params.parent = parent ? parent->GetNativeView() : NULL;
38 params.bounds = bounds; 38 params.bounds = bounds;
39
40 const MenuController* menu_controller =
41 submenu_->GetMenuItem()->GetMenuController();
42 const MenuConfig& menu_config = submenu_->GetMenuItem()->GetMenuConfig();
43 if (menu_controller && menu_config.corner_radius > 0)
44 params.transparent = true;
39 Init(params); 45 Init(params);
40 46
41 if (ui::NativeTheme::IsNewMenuStyleEnabled()) {
42 // TODO(yefim): Investigate it more on aura.
43 gfx::Path path;
44 RoundRectPainter::CreateRoundRectPath(bounds, &path);
45 SetShape(path.CreateNativeRegion());
46 }
47
48 SetContentsView(contents_view); 47 SetContentsView(contents_view);
48 if (menu_controller && menu_config.corner_radius > 0)
49 SetOpacity(0);
49 ShowMenuHost(do_capture); 50 ShowMenuHost(do_capture);
50 } 51 }
51 52
52 bool MenuHost::IsMenuHostVisible() { 53 bool MenuHost::IsMenuHostVisible() {
53 return IsVisible(); 54 return IsVisible();
54 } 55 }
55 56
56 void MenuHost::ShowMenuHost(bool do_capture) { 57 void MenuHost::ShowMenuHost(bool do_capture) {
57 // Doing a capture may make us get capture lost. Ignore it while we're in the 58 // Doing a capture may make us get capture lost. Ignore it while we're in the
58 // process of showing. 59 // process of showing.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (destroying_) 122 if (destroying_)
122 return; 123 return;
123 124
124 MenuController* menu_controller = 125 MenuController* menu_controller =
125 submenu_->GetMenuItem()->GetMenuController(); 126 submenu_->GetMenuItem()->GetMenuController();
126 if (menu_controller && !menu_controller->drag_in_progress()) 127 if (menu_controller && !menu_controller->drag_in_progress())
127 menu_controller->CancelAll(); 128 menu_controller->CancelAll();
128 } 129 }
129 130
130 } // namespace views 131 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_config_views.cc ('k') | ui/views/controls/menu/menu_scroll_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698