summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 15:47:38 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 15:47:38 +0000
commit267a9cee32a87c9d6a489ffd02d77ec40d6d9d1b (patch)
tree0c9e3b7aef44b3cc48469dfcd77e4b8f959dd423 /views
parent9fc4f203c93d906a5b94a0e48556ee52515185f0 (diff)
downloadchromium_src-267a9cee32a87c9d6a489ffd02d77ec40d6d9d1b.zip
chromium_src-267a9cee32a87c9d6a489ffd02d77ec40d6d9d1b.tar.gz
chromium_src-267a9cee32a87c9d6a489ffd02d77ec40d6d9d1b.tar.bz2
Fixes menus when shown by way of pressing alt-f. I need to turn on
nested tasks as in some situations the menu may be shown when the message loop is processing a task. If the message loop is processing a taskand we don't set nested tasks allowed to true then none of the tasks scheduled by the menu (paints, delays...) are processed and the menu appears totally broken. BUG=48102 TEST=give focus to the page, press alt-f, press arrow keys and make sure the menu updates appropriately. Review URL: http://codereview.chromium.org/2836044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_controller.cc16
-rw-r--r--views/controls/menu/menu_item_view.cc3
-rw-r--r--views/controls/menu/menu_item_view.h4
3 files changed, 8 insertions, 15 deletions
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index ae099f7..2c00e5e 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -268,15 +268,15 @@ MenuItemView* MenuController::Run(gfx::NativeWindow parent,
if (ViewsDelegate::views_delegate)
ViewsDelegate::views_delegate->AddRef();
+ // We need to turn on nestable tasks as in some situations (pressing alt-f for
+ // one) the menus are run from a task. If we don't do this and are invoked
+ // from a task none of the tasks we schedule are processed and the menu
+ // appears totally broken.
MessageLoopForUI* loop = MessageLoopForUI::current();
- if (MenuItemView::allow_task_nesting_during_run_) {
- bool did_allow_task_nesting = loop->NestableTasksAllowed();
- loop->SetNestableTasksAllowed(true);
- loop->Run(this);
- loop->SetNestableTasksAllowed(did_allow_task_nesting);
- } else {
- loop->Run(this);
- }
+ bool did_allow_task_nesting = loop->NestableTasksAllowed();
+ loop->SetNestableTasksAllowed(true);
+ loop->Run(this);
+ loop->SetNestableTasksAllowed(did_allow_task_nesting);
if (ViewsDelegate::views_delegate)
ViewsDelegate::views_delegate->ReleaseRef();
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index cb87761..1a5d8eb 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -57,9 +57,6 @@ const int MenuItemView::kEmptyMenuItemViewID =
MenuItemView::kMenuItemViewID + 1;
// static
-bool MenuItemView::allow_task_nesting_during_run_ = false;
-
-// static
int MenuItemView::label_start_;
// static
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
index 87ef1f6..baa3461 100644
--- a/views/controls/menu/menu_item_view.h
+++ b/views/controls/menu/menu_item_view.h
@@ -55,10 +55,6 @@ class MenuItemView : public View {
// ID used to identify empty menu items.
static const int kEmptyMenuItemViewID;
- // If true SetNestableTasksAllowed(true) is invoked before MessageLoop::Run
- // is invoked. This is only useful for testing and defaults to false.
- static bool allow_task_nesting_during_run_;
-
// Different types of menu items.
enum Type {
NORMAL,