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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 // Reset touch_pressed_handler_ to indicate that no processing is occurring. | 448 // Reset touch_pressed_handler_ to indicate that no processing is occurring. |
449 touch_pressed_handler_ = NULL; | 449 touch_pressed_handler_ = NULL; |
450 | 450 |
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_) { | |
sadrul
2012/07/26 18:41:28
This is not the right place. The event will not bu
tdanderson
2012/07/27 15:27:04
Done.
| |
459 gfx::Rect bounding_box(event.details().bounding_box()); | |
460 gfx::Point bounding_box_location(bounding_box.x(), bounding_box.y()); | |
461 ConvertPointToScreen(this, &bounding_box_location); | |
462 gfx::Rect touch_rect(bounding_box_location.x(), | |
463 bounding_box_location.y(), | |
464 bounding_box.width(), | |
465 bounding_box.height()); | |
466 gesture_handler_ = GetEventHandlerForRect(touch_rect); | |
sadrul
2012/07/26 18:41:28
You could perhaps use bounding_box.set_origin here
tdanderson
2012/07/27 15:27:04
Done.
| |
467 } | |
468 | |
458 if (gesture_handler_) { | 469 if (gesture_handler_) { |
459 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during | 470 // |gesture_handler_| (or |scroll_gesture_handler_|) can be deleted during |
460 // processing. | 471 // processing. |
461 View* handler = event.IsScrollGestureEvent() && scroll_gesture_handler_ ? | 472 View* handler = event.IsScrollGestureEvent() && scroll_gesture_handler_ ? |
462 scroll_gesture_handler_ : gesture_handler_; | 473 scroll_gesture_handler_ : gesture_handler_; |
463 GestureEvent handler_event(event, this, handler); | 474 GestureEvent handler_event(event, this, handler); |
464 | 475 |
465 ui::GestureStatus status = handler->ProcessGestureEvent(handler_event); | 476 ui::GestureStatus status = handler->ProcessGestureEvent(handler_event); |
466 | 477 |
467 if (event.type() == ui::ET_GESTURE_END && | 478 if (event.type() == ui::ET_GESTURE_END && |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 } | 610 } |
600 | 611 |
601 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 612 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
602 last_mouse_event_flags_ = event.flags(); | 613 last_mouse_event_flags_ = event.flags(); |
603 last_mouse_event_x_ = event.x(); | 614 last_mouse_event_x_ = event.x(); |
604 last_mouse_event_y_ = event.y(); | 615 last_mouse_event_y_ = event.y(); |
605 } | 616 } |
606 | 617 |
607 } // namespace internal | 618 } // namespace internal |
608 } // namespace views | 619 } // namespace views |
OLD | NEW |