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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 return status; | 451 return status; |
452 } | 452 } |
453 | 453 |
454 ui::GestureStatus RootView::OnGestureEvent(const GestureEvent& event) { | 454 ui::GestureStatus RootView::OnGestureEvent(const GestureEvent& event) { |
455 GestureEvent e(event, this); | 455 GestureEvent e(event, this); |
456 ui::GestureStatus status = ui::GESTURE_STATUS_UNKNOWN; | 456 ui::GestureStatus status = ui::GESTURE_STATUS_UNKNOWN; |
457 | 457 |
458 if (gesture_handler_) { | 458 if (gesture_handler_) { |
459 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during | 459 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during |
460 // processing. | 460 // processing. |
461 View* handler = event.IsScrollGestureEvent() && scroll_gesture_handler_ ? | 461 View* handler = scroll_gesture_handler_ && |
462 scroll_gesture_handler_ : gesture_handler_; | 462 (event.IsScrollGestureEvent() || event.IsFlingScrollEvent()) ? |
| 463 scroll_gesture_handler_ : gesture_handler_; |
463 GestureEvent handler_event(event, this, handler); | 464 GestureEvent handler_event(event, this, handler); |
464 | 465 |
465 ui::GestureStatus status = handler->ProcessGestureEvent(handler_event); | 466 ui::GestureStatus status = handler->ProcessGestureEvent(handler_event); |
466 | 467 |
467 if (event.type() == ui::ET_GESTURE_END && | 468 if (event.type() == ui::ET_GESTURE_END && |
468 event.details().touch_points() <= 1) | 469 event.details().touch_points() <= 1) |
469 gesture_handler_ = NULL; | 470 gesture_handler_ = NULL; |
470 | 471 |
471 if (event.type() == ui::ET_GESTURE_SCROLL_END && scroll_gesture_handler_) | 472 if (scroll_gesture_handler_ && (event.type() == ui::ET_GESTURE_SCROLL_END || |
| 473 event.type() == ui::ET_SCROLL_FLING_START)) |
472 scroll_gesture_handler_ = NULL; | 474 scroll_gesture_handler_ = NULL; |
473 | 475 |
474 if (status == ui::GESTURE_STATUS_CONSUMED) | 476 if (status == ui::GESTURE_STATUS_CONSUMED) |
475 return status; | 477 return status; |
476 | 478 |
477 DCHECK_EQ(ui::GESTURE_STATUS_UNKNOWN, status); | 479 DCHECK_EQ(ui::GESTURE_STATUS_UNKNOWN, status); |
478 | 480 |
479 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN && | 481 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN && |
480 !scroll_gesture_handler_) { | 482 !scroll_gesture_handler_) { |
481 // Some view started processing gesture events, however it does not | 483 // Some view started processing gesture events, however it does not |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 601 } |
600 | 602 |
601 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 603 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
602 last_mouse_event_flags_ = event.flags(); | 604 last_mouse_event_flags_ = event.flags(); |
603 last_mouse_event_x_ = event.x(); | 605 last_mouse_event_x_ = event.x(); |
604 last_mouse_event_y_ = event.y(); | 606 last_mouse_event_y_ = event.y(); |
605 } | 607 } |
606 | 608 |
607 } // namespace internal | 609 } // namespace internal |
608 } // namespace views | 610 } // namespace views |
OLD | NEW |