summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 16:23:05 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 16:23:05 +0000
commitf77c468b6ffdc8fd49299f7b914220368758a951 (patch)
tree1e6ec9b20e941af7f20383c0b5871b909c5f5178 /views
parenteeb4e4a8796ee1eb0041f230a06bdfb5e37572b1 (diff)
downloadchromium_src-f77c468b6ffdc8fd49299f7b914220368758a951.zip
chromium_src-f77c468b6ffdc8fd49299f7b914220368758a951.tar.gz
chromium_src-f77c468b6ffdc8fd49299f7b914220368758a951.tar.bz2
Fixes regression from menu refactoring. The old windows code wasn't
correctly listening to capture change, so that once I wired it up it exposed a bug. I need to suppress capture change notification when hiding a menu, otherwise it prematurely triggers cancelling menus. BUG=89594 TEST=see bug, also covered by automated tests now. R=oshima@chromium.org Review URL: http://codereview.chromium.org/7390032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/menu_host.cc10
-rw-r--r--views/controls/menu/menu_host.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc
index b767feb..f43800d 100644
--- a/views/controls/menu/menu_host.cc
+++ b/views/controls/menu/menu_host.cc
@@ -20,7 +20,7 @@ namespace views {
MenuHost::MenuHost(SubmenuView* submenu)
: submenu_(submenu),
destroying_(false),
- showing_(false) {
+ ignore_capture_lost_(false) {
}
MenuHost::~MenuHost() {
@@ -50,7 +50,7 @@ bool MenuHost::IsMenuHostVisible() {
void MenuHost::ShowMenuHost(bool do_capture) {
// Doing a capture may make us get capture lost. Ignore it while we're in the
// process of showing.
- showing_ = true;
+ ignore_capture_lost_ = true;
Show();
if (do_capture) {
native_widget_private()->SetMouseCapture();
@@ -59,12 +59,14 @@ void MenuHost::ShowMenuHost(bool do_capture) {
// become active and confuse things.
native_widget_private()->SetKeyboardCapture();
}
- showing_ = false;
+ ignore_capture_lost_ = false;
}
void MenuHost::HideMenuHost() {
+ ignore_capture_lost_ = true;
ReleaseMenuHostCapture();
Hide();
+ ignore_capture_lost_ = false;
}
void MenuHost::DestroyMenuHost() {
@@ -97,7 +99,7 @@ bool MenuHost::ShouldReleaseCaptureOnMouseReleased() const {
}
void MenuHost::OnMouseCaptureLost() {
- if (destroying_ || showing_)
+ if (destroying_ || ignore_capture_lost_)
return;
MenuController* menu_controller =
submenu_->GetMenuItem()->GetMenuController();
diff --git a/views/controls/menu/menu_host.h b/views/controls/menu/menu_host.h
index 0b5417b..3edffb2 100644
--- a/views/controls/menu/menu_host.h
+++ b/views/controls/menu/menu_host.h
@@ -73,8 +73,8 @@ class MenuHost : public Widget {
// If true, DestroyMenuHost has been invoked.
bool destroying_;
- // If true, we're attempting to Show.
- bool showing_;
+ // If true and capture is lost we don't notify the delegate.
+ bool ignore_capture_lost_;
DISALLOW_COPY_AND_ASSIGN(MenuHost);
};