| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/root_view.h" | 5 #include "ui/views/widget/root_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during | 462 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during |
| 463 // processing. | 463 // processing. |
| 464 View* handler = scroll_gesture_handler_ && | 464 View* handler = scroll_gesture_handler_ && |
| 465 (event.IsScrollGestureEvent() || event.IsFlingScrollEvent()) ? | 465 (event.IsScrollGestureEvent() || event.IsFlingScrollEvent()) ? |
| 466 scroll_gesture_handler_ : gesture_handler_; | 466 scroll_gesture_handler_ : gesture_handler_; |
| 467 ui::GestureEvent handler_event(event, static_cast<View*>(this), handler); | 467 ui::GestureEvent handler_event(event, static_cast<View*>(this), handler); |
| 468 | 468 |
| 469 ui::EventResult status = handler->ProcessGestureEvent(handler_event); | 469 ui::EventResult status = handler->ProcessGestureEvent(handler_event); |
| 470 | 470 |
| 471 if (event.type() == ui::ET_GESTURE_END && | 471 if (event.type() == ui::ET_GESTURE_END && |
| 472 event.details().touch_points() <= 1) | 472 event.details().touch_points() <= 1) { |
| 473 gesture_handler_ = NULL; | 473 // In case a drag was in progress, reset all the handlers. Otherwise, just |
| 474 // reset the gesture handler. |
| 475 if (gesture_handler_ == mouse_pressed_handler_) |
| 476 SetMouseHandler(NULL); |
| 477 else |
| 478 gesture_handler_ = NULL; |
| 479 } |
| 474 | 480 |
| 475 if (scroll_gesture_handler_ && (event.type() == ui::ET_GESTURE_SCROLL_END || | 481 if (scroll_gesture_handler_ && (event.type() == ui::ET_GESTURE_SCROLL_END || |
| 476 event.type() == ui::ET_SCROLL_FLING_START)) | 482 event.type() == ui::ET_SCROLL_FLING_START)) |
| 477 scroll_gesture_handler_ = NULL; | 483 scroll_gesture_handler_ = NULL; |
| 478 | 484 |
| 479 if (status == ui::ER_CONSUMED) | 485 if (status == ui::ER_CONSUMED) |
| 480 return status; | 486 return status; |
| 481 | 487 |
| 482 DCHECK_EQ(ui::ER_UNHANDLED, status); | 488 DCHECK_EQ(ui::ER_UNHANDLED, status); |
| 483 | 489 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 613 } |
| 608 | 614 |
| 609 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { | 615 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { |
| 610 last_mouse_event_flags_ = event.flags(); | 616 last_mouse_event_flags_ = event.flags(); |
| 611 last_mouse_event_x_ = event.x(); | 617 last_mouse_event_x_ = event.x(); |
| 612 last_mouse_event_y_ = event.y(); | 618 last_mouse_event_y_ = event.y(); |
| 613 } | 619 } |
| 614 | 620 |
| 615 } // namespace internal | 621 } // namespace internal |
| 616 } // namespace views | 622 } // namespace views |
| OLD | NEW |