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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 offset(other.offset) {} | 563 offset(other.offset) {} |
564 | 564 |
565 const PointerId PointerDetails::kUnknownPointerId = -1; | 565 const PointerId PointerDetails::kUnknownPointerId = -1; |
566 | 566 |
567 //////////////////////////////////////////////////////////////////////////////// | 567 //////////////////////////////////////////////////////////////////////////////// |
568 // MouseEvent | 568 // MouseEvent |
569 | 569 |
570 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 570 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
571 : LocatedEvent(native_event), | 571 : LocatedEvent(native_event), |
572 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), | 572 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), |
573 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { | 573 pointer_details_(GetMousePointerDetailsFromNative(native_event)), |
| 574 only_for_ui_hover_state_(false) { |
574 latency()->AddLatencyNumberWithTimestamp( | 575 latency()->AddLatencyNumberWithTimestamp( |
575 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, | 576 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
576 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); | 577 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
577 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 578 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
578 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) | 579 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) |
579 SetClickCount(GetRepeatCount(*this)); | 580 SetClickCount(GetRepeatCount(*this)); |
580 } | 581 } |
581 | 582 |
582 MouseEvent::MouseEvent(const PointerEvent& pointer_event) | 583 MouseEvent::MouseEvent(const PointerEvent& pointer_event) |
583 : LocatedEvent(pointer_event), | 584 : LocatedEvent(pointer_event), |
584 changed_button_flags_(pointer_event.changed_button_flags()), | 585 changed_button_flags_(pointer_event.changed_button_flags()), |
585 pointer_details_(pointer_event.pointer_details()) { | 586 pointer_details_(pointer_event.pointer_details()), |
| 587 only_for_ui_hover_state_(false) { |
586 DCHECK(pointer_event.IsMousePointerEvent()); | 588 DCHECK(pointer_event.IsMousePointerEvent()); |
587 switch (pointer_event.type()) { | 589 switch (pointer_event.type()) { |
588 case ET_POINTER_DOWN: | 590 case ET_POINTER_DOWN: |
589 SetType(ET_MOUSE_PRESSED); | 591 SetType(ET_MOUSE_PRESSED); |
590 break; | 592 break; |
591 | 593 |
592 case ET_POINTER_MOVED: | 594 case ET_POINTER_MOVED: |
593 if (pointer_event.flags() & | 595 if (pointer_event.flags() & |
594 (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON | | 596 (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON | |
595 EF_RIGHT_MOUSE_BUTTON)) { | 597 EF_RIGHT_MOUSE_BUTTON)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 base::TimeTicks time_stamp, | 633 base::TimeTicks time_stamp, |
632 int flags, | 634 int flags, |
633 int changed_button_flags, | 635 int changed_button_flags, |
634 const PointerDetails& pointer_details) | 636 const PointerDetails& pointer_details) |
635 : LocatedEvent(type, | 637 : LocatedEvent(type, |
636 gfx::PointF(location), | 638 gfx::PointF(location), |
637 gfx::PointF(root_location), | 639 gfx::PointF(root_location), |
638 time_stamp, | 640 time_stamp, |
639 flags), | 641 flags), |
640 changed_button_flags_(changed_button_flags), | 642 changed_button_flags_(changed_button_flags), |
641 pointer_details_(pointer_details) { | 643 pointer_details_(pointer_details), |
| 644 only_for_ui_hover_state_(false) { |
642 DCHECK_NE(ET_MOUSEWHEEL, type); | 645 DCHECK_NE(ET_MOUSEWHEEL, type); |
643 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 646 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
644 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 647 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
645 SetType(ET_MOUSE_DRAGGED); | 648 SetType(ET_MOUSE_DRAGGED); |
646 } | 649 } |
647 | 650 |
648 // static | 651 // static |
649 bool MouseEvent::IsRepeatedClickEvent( | 652 bool MouseEvent::IsRepeatedClickEvent( |
650 const MouseEvent& event1, | 653 const MouseEvent& event1, |
651 const MouseEvent& event2) { | 654 const MouseEvent& event2) { |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 flags | EF_FROM_TOUCH), | 1461 flags | EF_FROM_TOUCH), |
1459 details_(details), | 1462 details_(details), |
1460 unique_touch_event_id_(unique_touch_event_id) { | 1463 unique_touch_event_id_(unique_touch_event_id) { |
1461 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1464 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
1462 } | 1465 } |
1463 | 1466 |
1464 GestureEvent::~GestureEvent() { | 1467 GestureEvent::~GestureEvent() { |
1465 } | 1468 } |
1466 | 1469 |
1467 } // namespace ui | 1470 } // namespace ui |
OLD | NEW |