Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: ui/events/event.cc

Issue 2720133002: Make pinch zoom work on chromeos by setting touch id correctly (Closed)
Patch Set: pinch zoom on chromeos Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 f &= ~EF_IS_TRIPLE_CLICK; 755 f &= ~EF_IS_TRIPLE_CLICK;
756 break; 756 break;
757 case 3: 757 case 3:
758 f &= ~EF_IS_DOUBLE_CLICK; 758 f &= ~EF_IS_DOUBLE_CLICK;
759 f |= EF_IS_TRIPLE_CLICK; 759 f |= EF_IS_TRIPLE_CLICK;
760 break; 760 break;
761 } 761 }
762 set_flags(f); 762 set_flags(f);
763 } 763 }
764 764
765 void MouseEvent::set_pointer_details(const PointerDetails& details) {
766 if (details.pointer_type == EventPointerType::POINTER_TYPE_TOUCH) {
sadrul 2017/03/01 15:35:59 For MouseEvent, when do we set pointer_type to TYP
lanwei 2017/03/01 20:12:22 So far, I have not seen. I am afraid it may be set
767 DCHECK(pointer_details_.id == 0 || details.id != 0);
768 } else {
769 DCHECK(pointer_details_.id == PointerEvent::kMousePointerId ||
770 details.id != PointerEvent::kMousePointerId);
771 }
772 pointer_details_ = details;
773 }
774
765 //////////////////////////////////////////////////////////////////////////////// 775 ////////////////////////////////////////////////////////////////////////////////
766 // MouseWheelEvent 776 // MouseWheelEvent
767 777
768 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event) 778 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event)
769 : MouseEvent(native_event), 779 : MouseEvent(native_event),
770 offset_(GetMouseWheelOffset(native_event)) { 780 offset_(GetMouseWheelOffset(native_event)) {
771 } 781 }
772 782
773 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event) 783 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event)
774 : MouseEvent(scroll_event), 784 : MouseEvent(scroll_event),
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 static_cast<EventResult>(result() | ER_DISABLE_SYNC_HANDLING)); 975 static_cast<EventResult>(result() | ER_DISABLE_SYNC_HANDLING));
966 } 976 }
967 977
968 void TouchEvent::FixRotationAngle() { 978 void TouchEvent::FixRotationAngle() {
969 while (rotation_angle_ < 0) 979 while (rotation_angle_ < 0)
970 rotation_angle_ += 180; 980 rotation_angle_ += 180;
971 while (rotation_angle_ >= 180) 981 while (rotation_angle_ >= 180)
972 rotation_angle_ -= 180; 982 rotation_angle_ -= 180;
973 } 983 }
974 984
985 void TouchEvent::set_pointer_details(const PointerDetails& pointer_details) {
986 if (pointer_details.pointer_type == EventPointerType::POINTER_TYPE_TOUCH) {
987 DCHECK(pointer_details_.id == 0 || pointer_details.id != 0);
988 } else {
989 DCHECK(pointer_details_.id == PointerEvent::kMousePointerId ||
990 pointer_details.id != PointerEvent::kMousePointerId);
sadrul 2017/03/01 15:35:59 When do we create a TouchEvent when pointer_type i
lanwei 2017/03/01 20:12:22 On Kevin (chromebook) device, the pointer type is
991 }
992 pointer_details_ = pointer_details;
993 }
994
975 //////////////////////////////////////////////////////////////////////////////// 995 ////////////////////////////////////////////////////////////////////////////////
976 // PointerEvent 996 // PointerEvent
977 997
978 bool PointerEvent::CanConvertFrom(const Event& event) { 998 bool PointerEvent::CanConvertFrom(const Event& event) {
979 switch (event.type()) { 999 switch (event.type()) {
980 case ET_MOUSE_PRESSED: 1000 case ET_MOUSE_PRESSED:
981 case ET_MOUSE_DRAGGED: 1001 case ET_MOUSE_DRAGGED:
982 case ET_MOUSE_MOVED: 1002 case ET_MOUSE_MOVED:
983 case ET_MOUSE_ENTERED: 1003 case ET_MOUSE_ENTERED:
984 case ET_MOUSE_EXITED: 1004 case ET_MOUSE_EXITED:
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 flags | EF_FROM_TOUCH), 1471 flags | EF_FROM_TOUCH),
1452 details_(details), 1472 details_(details),
1453 unique_touch_event_id_(unique_touch_event_id) { 1473 unique_touch_event_id_(unique_touch_event_id) {
1454 latency()->set_source_event_type(ui::SourceEventType::TOUCH); 1474 latency()->set_source_event_type(ui::SourceEventType::TOUCH);
1455 } 1475 }
1456 1476
1457 GestureEvent::~GestureEvent() { 1477 GestureEvent::~GestureEvent() {
1458 } 1478 }
1459 1479
1460 } // namespace ui 1480 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698