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

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: Address comments, fix tests, cleanup, 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
« no previous file with comments | « views/widget/root_view.h ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/root_view.cc
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index fed3f015a52094da1e4368cac7fd588efc783c1a..aae04b7bec0d35f4f8a8a12b59f2fa36b63fd2b7 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);
@@ -272,9 +263,23 @@ void RootView::OnMouseReleased(const MouseEvent& event, bool canceled) {
// 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->ProcessMouseReleased(mouse_released, canceled);
+ SetMouseHandler(NULL);
+ mouse_pressed_handler->ProcessMouseReleased(mouse_released);
+ // WARNING: we may have been deleted.
+ }
+}
+
+void RootView::OnMouseCaptureLost() {
+ if (mouse_pressed_handler_) {
+ // Synthesize a release event for UpdateCursor and OnMouseReleased.
+ MouseEvent release_event(ui::ET_MOUSE_RELEASED, last_mouse_event_x_,
+ last_mouse_event_y_, last_mouse_event_flags_);
+ UpdateCursor(release_event);
+ // We allow the view to delete us from OnMouseCaptureLost. As such,
+ // configure state such that we're done first, then call View.
+ View* mouse_pressed_handler = mouse_pressed_handler_;
+ SetMouseHandler(NULL);
+ mouse_pressed_handler->OnMouseCaptureLost();
// WARNING: we may have been deleted.
}
}
« no previous file with comments | « views/widget/root_view.h ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698