Chromium Code Reviews| Index: ui/views/widget/widget.cc |
| diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc |
| index 17675e73c44d8c90681eabff93600f6de4b5d1d4..6d93da70f430fb15c2ab84b4a3f81968b818952d 100644 |
| --- a/ui/views/widget/widget.cc |
| +++ b/ui/views/widget/widget.cc |
| @@ -1174,16 +1174,22 @@ void Widget::OnMouseEvent(ui::MouseEvent* event) { |
| // Make sure we're still visible before we attempt capture as the mouse |
| // press processing may have made the window hide (as happens with menus). |
| - // It is possible for a View to show a context menu on mouse-press. Since |
| - // the menu does a capture and starts a nested message-loop, the release |
| - // would go to the menu. The next click (i.e. both mouse-press and release |
| - // events) also go to the menu. The menu (and the nested message-loop) |
| - // gets closed after this second release event. The code then resumes from |
| - // here. So make sure that the mouse-button is still down before doing a |
| - // capture. |
| + // It is possible for a View to show a context menu on mouse-press, which |
| + // takes capture. |
| + // |
| + // Menus which use a nested message-loop, receive the release. The next |
| + // click (i.e. both mouse-press and release events) also go to the menu. |
| + // The menu (and the nested message-loop) gets closed after this second |
| + // release event. The code then resumes from here. So make sure that the |
| + // mouse-button is still down before doing a capture. |
| + // |
| + // Menus which do not use a nested message-loop will return here, holding |
| + // capture. If there is an active MenuController do not reassign capture |
| + // to |native_widget_|. |
| if (root_view && root_view->OnMousePressed(*event) && |
| widget_deletion_observer.IsWidgetAlive() && IsVisible() && |
| - internal::NativeWidgetPrivate::IsMouseButtonDown()) { |
| + internal::NativeWidgetPrivate::IsMouseButtonDown() && |
| + !MenuController::GetActiveInstance()) { |
|
sky
2016/05/05 16:34:39
I don't like having to special case the check for
jonross
2016/05/05 17:50:42
I believe that could account for this. I'm not awa
|
| is_mouse_button_pressed_ = true; |
| if (!native_widget_->HasCapture()) |
| native_widget_->SetCapture(); |