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

Unified Diff: views/widget/root_view.cc

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refinements, etc. Created 9 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 side-by-side diff with in-line comments
Download patch
Index: views/widget/root_view.cc
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index f5ceffe67b5de8659271ef81afbd013cbb68c282..b5fe629fb1dfd812de1cc89c1a72f19014e709db 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -82,15 +82,6 @@ void RootView::NotifyNativeViewHierarchyChanged(bool attached,
// Input -----------------------------------------------------------------------
-void RootView::ProcessMouseDragCanceled() {
- if (mouse_pressed_handler_) {
- // Synthesize a release event.
- MouseEvent release_event(ui::ET_MOUSE_RELEASED, last_mouse_event_x_,
- last_mouse_event_y_, last_mouse_event_flags_);
- OnMouseReleased(release_event, true);
- }
-}
-
bool RootView::ProcessKeyEvent(const KeyEvent& event) {
bool consumed = false;
@@ -261,7 +252,7 @@ bool RootView::OnMouseDragged(const MouseEvent& event) {
return false;
}
-void RootView::OnMouseReleased(const MouseEvent& event, bool canceled) {
+void RootView::OnMouseReleased(const MouseEvent& event) {
MouseEvent e(event, this);
UpdateCursor(e);
@@ -274,7 +265,20 @@ void RootView::OnMouseReleased(const MouseEvent& event, bool canceled) {
View* mouse_pressed_handler = mouse_pressed_handler_;
mouse_pressed_handler_ = NULL;
explicit_mouse_handler_ = false;
- mouse_pressed_handler->ProcessMouseReleased(mouse_released, canceled);
+ mouse_pressed_handler->ProcessMouseReleased(mouse_released);
+ // WARNING: we may have been deleted.
+ }
+}
+
+void RootView::OnMouseCaptureLost() {
+ // TODO(msw): Call UpdateCursor with a synthesized event?
+ if (mouse_pressed_handler_) {
+ // We allow the view to delete us from ProcessMouseReleased. As such,
+ // configure state such that we're done first, then call View.
+ View* mouse_pressed_handler = mouse_pressed_handler_;
+ mouse_pressed_handler_ = NULL;
+ explicit_mouse_handler_ = false;
+ mouse_pressed_handler->OnMouseCaptureLost();
// WARNING: we may have been deleted.
}
}

Powered by Google App Engine
This is Rietveld 408576698