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/events/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 | 10 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 base::TimeTicks time_stamp, | 515 base::TimeTicks time_stamp, |
516 int flags, | 516 int flags, |
517 int changed_button_flags) | 517 int changed_button_flags) |
518 : LocatedEvent(type, | 518 : LocatedEvent(type, |
519 gfx::PointF(location), | 519 gfx::PointF(location), |
520 gfx::PointF(root_location), | 520 gfx::PointF(root_location), |
521 time_stamp, | 521 time_stamp, |
522 flags), | 522 flags), |
523 changed_button_flags_(changed_button_flags), | 523 changed_button_flags_(changed_button_flags), |
524 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { | 524 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { |
525 DCHECK(type != ET_MOUSEWHEEL); | |
sadrul
2016/08/29 16:02:36
DCHECK_NE
riajiang
2016/08/29 16:17:54
Done.
| |
525 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 526 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
526 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 527 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
527 SetType(ET_MOUSE_DRAGGED); | 528 SetType(ET_MOUSE_DRAGGED); |
528 } | 529 } |
529 | 530 |
530 // static | 531 // static |
531 bool MouseEvent::IsRepeatedClickEvent( | 532 bool MouseEvent::IsRepeatedClickEvent( |
532 const MouseEvent& event1, | 533 const MouseEvent& event1, |
533 const MouseEvent& event2) { | 534 const MouseEvent& event2) { |
534 // These values match the Windows defaults. | 535 // These values match the Windows defaults. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 offset_(mouse_wheel_event.offset()) { | 673 offset_(mouse_wheel_event.offset()) { |
673 DCHECK(type() == ET_MOUSEWHEEL); | 674 DCHECK(type() == ET_MOUSEWHEEL); |
674 } | 675 } |
675 | 676 |
676 MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset, | 677 MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset, |
677 const gfx::Point& location, | 678 const gfx::Point& location, |
678 const gfx::Point& root_location, | 679 const gfx::Point& root_location, |
679 base::TimeTicks time_stamp, | 680 base::TimeTicks time_stamp, |
680 int flags, | 681 int flags, |
681 int changed_button_flags) | 682 int changed_button_flags) |
682 : MouseEvent(ui::ET_MOUSEWHEEL, | 683 : MouseEvent(ui::ET_UNKNOWN, |
683 location, | 684 location, |
684 root_location, | 685 root_location, |
685 time_stamp, | 686 time_stamp, |
686 flags, | 687 flags, |
687 changed_button_flags), | 688 changed_button_flags), |
688 offset_(offset) {} | 689 offset_(offset) { |
690 SetType(ui::ET_MOUSEWHEEL); | |
sadrul
2016/08/29 16:02:36
Add a comment here why we are doing this.
riajiang
2016/08/29 16:17:54
Done.
| |
691 } | |
689 | 692 |
690 #if defined(OS_WIN) | 693 #if defined(OS_WIN) |
691 // This value matches windows WHEEL_DELTA. | 694 // This value matches windows WHEEL_DELTA. |
692 // static | 695 // static |
693 const int MouseWheelEvent::kWheelDelta = 120; | 696 const int MouseWheelEvent::kWheelDelta = 120; |
694 #else | 697 #else |
695 // This value matches GTK+ wheel scroll amount. | 698 // This value matches GTK+ wheel scroll amount. |
696 const int MouseWheelEvent::kWheelDelta = 53; | 699 const int MouseWheelEvent::kWheelDelta = 53; |
697 #endif | 700 #endif |
698 | 701 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 gfx::PointF(x, y), | 1302 gfx::PointF(x, y), |
1300 time_stamp, | 1303 time_stamp, |
1301 flags | EF_FROM_TOUCH), | 1304 flags | EF_FROM_TOUCH), |
1302 details_(details), | 1305 details_(details), |
1303 unique_touch_event_id_(unique_touch_event_id) {} | 1306 unique_touch_event_id_(unique_touch_event_id) {} |
1304 | 1307 |
1305 GestureEvent::~GestureEvent() { | 1308 GestureEvent::~GestureEvent() { |
1306 } | 1309 } |
1307 | 1310 |
1308 } // namespace ui | 1311 } // namespace ui |
OLD | NEW |