| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 default: | 618 default: |
| 619 NOTREACHED(); | 619 NOTREACHED(); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 MouseEvent::MouseEvent(EventType type, | 623 MouseEvent::MouseEvent(EventType type, |
| 624 const gfx::Point& location, | 624 const gfx::Point& location, |
| 625 const gfx::Point& root_location, | 625 const gfx::Point& root_location, |
| 626 base::TimeTicks time_stamp, | 626 base::TimeTicks time_stamp, |
| 627 int flags, | 627 int flags, |
| 628 int changed_button_flags) | 628 int changed_button_flags, |
| 629 const PointerDetails& pointer_details) |
| 629 : LocatedEvent(type, | 630 : LocatedEvent(type, |
| 630 gfx::PointF(location), | 631 gfx::PointF(location), |
| 631 gfx::PointF(root_location), | 632 gfx::PointF(root_location), |
| 632 time_stamp, | 633 time_stamp, |
| 633 flags), | 634 flags), |
| 634 changed_button_flags_(changed_button_flags), | 635 changed_button_flags_(changed_button_flags), |
| 635 pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) { | 636 pointer_details_(pointer_details) { |
| 636 DCHECK_NE(ET_MOUSEWHEEL, type); | 637 DCHECK_NE(ET_MOUSEWHEEL, type); |
| 637 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 638 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 638 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 639 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
| 639 SetType(ET_MOUSE_DRAGGED); | 640 SetType(ET_MOUSE_DRAGGED); |
| 640 } | 641 } |
| 641 | 642 |
| 642 // static | 643 // static |
| 643 bool MouseEvent::IsRepeatedClickEvent( | 644 bool MouseEvent::IsRepeatedClickEvent( |
| 644 const MouseEvent& event1, | 645 const MouseEvent& event1, |
| 645 const MouseEvent& event2) { | 646 const MouseEvent& event2) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 const gfx::Point& location, | 806 const gfx::Point& location, |
| 806 const gfx::Point& root_location, | 807 const gfx::Point& root_location, |
| 807 base::TimeTicks time_stamp, | 808 base::TimeTicks time_stamp, |
| 808 int flags, | 809 int flags, |
| 809 int changed_button_flags) | 810 int changed_button_flags) |
| 810 : MouseEvent(ui::ET_UNKNOWN, | 811 : MouseEvent(ui::ET_UNKNOWN, |
| 811 location, | 812 location, |
| 812 root_location, | 813 root_location, |
| 813 time_stamp, | 814 time_stamp, |
| 814 flags, | 815 flags, |
| 815 changed_button_flags), | 816 changed_button_flags, |
| 817 PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 818 PointerEvent::kMousePointerId)), |
| 816 offset_(offset) { | 819 offset_(offset) { |
| 817 // Set event type to ET_UNKNOWN initially in MouseEvent() to pass the | 820 // Set event type to ET_UNKNOWN initially in MouseEvent() to pass the |
| 818 // DCHECK for type to enforce that we use MouseWheelEvent() to create | 821 // DCHECK for type to enforce that we use MouseWheelEvent() to create |
| 819 // a MouseWheelEvent. | 822 // a MouseWheelEvent. |
| 820 SetType(ui::ET_MOUSEWHEEL); | 823 SetType(ui::ET_MOUSEWHEEL); |
| 821 } | 824 } |
| 822 | 825 |
| 823 #if defined(OS_WIN) | 826 #if defined(OS_WIN) |
| 824 // This value matches windows WHEEL_DELTA. | 827 // This value matches windows WHEEL_DELTA. |
| 825 // static | 828 // static |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 ScrollEvent::ScrollEvent(EventType type, | 1407 ScrollEvent::ScrollEvent(EventType type, |
| 1405 const gfx::Point& location, | 1408 const gfx::Point& location, |
| 1406 base::TimeTicks time_stamp, | 1409 base::TimeTicks time_stamp, |
| 1407 int flags, | 1410 int flags, |
| 1408 float x_offset, | 1411 float x_offset, |
| 1409 float y_offset, | 1412 float y_offset, |
| 1410 float x_offset_ordinal, | 1413 float x_offset_ordinal, |
| 1411 float y_offset_ordinal, | 1414 float y_offset_ordinal, |
| 1412 int finger_count, | 1415 int finger_count, |
| 1413 EventMomentumPhase momentum_phase) | 1416 EventMomentumPhase momentum_phase) |
| 1414 : MouseEvent(type, location, location, time_stamp, flags, 0), | 1417 : MouseEvent(type, |
| 1418 location, |
| 1419 location, |
| 1420 time_stamp, |
| 1421 flags, |
| 1422 0, |
| 1423 PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, |
| 1424 PointerEvent::kMousePointerId)), |
| 1415 x_offset_(x_offset), | 1425 x_offset_(x_offset), |
| 1416 y_offset_(y_offset), | 1426 y_offset_(y_offset), |
| 1417 x_offset_ordinal_(x_offset_ordinal), | 1427 x_offset_ordinal_(x_offset_ordinal), |
| 1418 y_offset_ordinal_(y_offset_ordinal), | 1428 y_offset_ordinal_(y_offset_ordinal), |
| 1419 finger_count_(finger_count), | 1429 finger_count_(finger_count), |
| 1420 momentum_phase_(momentum_phase) { | 1430 momentum_phase_(momentum_phase) { |
| 1421 CHECK(IsScrollEvent()); | 1431 CHECK(IsScrollEvent()); |
| 1422 latency()->set_source_event_type(ui::SourceEventType::WHEEL); | 1432 latency()->set_source_event_type(ui::SourceEventType::WHEEL); |
| 1423 } | 1433 } |
| 1424 | 1434 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1445 flags | EF_FROM_TOUCH), | 1455 flags | EF_FROM_TOUCH), |
| 1446 details_(details), | 1456 details_(details), |
| 1447 unique_touch_event_id_(unique_touch_event_id) { | 1457 unique_touch_event_id_(unique_touch_event_id) { |
| 1448 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1458 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
| 1449 } | 1459 } |
| 1450 | 1460 |
| 1451 GestureEvent::~GestureEvent() { | 1461 GestureEvent::~GestureEvent() { |
| 1452 } | 1462 } |
| 1453 | 1463 |
| 1454 } // namespace ui | 1464 } // namespace ui |
| OLD | NEW |