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

Side by Side Diff: ui/events/gesture_detection/motion_event.cc

Issue 407313002: Add a MotionEventGeneric implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/events/gesture_detection/motion_event.h"
6
7 #include "base/logging.h"
8
9 namespace ui {
10
11 size_t MotionEvent::GetHistorySize() const {
12 return 0;
13 }
14
15 base::TimeTicks MotionEvent::GetHistoricalEventTime(
16 size_t historical_index) const {
17 NOTIMPLEMENTED();
18 return base::TimeTicks();
19 }
20
21 float MotionEvent::GetHistoricalTouchMajor(size_t pointer_index,
22 size_t historical_index) const {
23 NOTIMPLEMENTED();
24 return 0.f;
25 }
26
27 float MotionEvent::GetHistoricalX(size_t pointer_index,
28 size_t historical_index) const {
29 NOTIMPLEMENTED();
30 return 0.f;
31 }
32
33 float MotionEvent::GetHistoricalY(size_t pointer_index,
34 size_t historical_index) const {
35 NOTIMPLEMENTED();
36 return 0.f;
37 }
38
39 bool operator==(const MotionEvent& lhs, const MotionEvent& rhs) {
40 if (lhs.GetId() != rhs.GetId() || lhs.GetAction() != rhs.GetAction() ||
41 lhs.GetActionIndex() != rhs.GetActionIndex() ||
42 lhs.GetPointerCount() != rhs.GetPointerCount() ||
43 lhs.GetButtonState() != rhs.GetButtonState() ||
44 lhs.GetEventTime() != rhs.GetEventTime())
45 return false;
46
47 for (size_t i = 0; i < lhs.GetPointerCount(); ++i) {
48 if (lhs.GetX(i) != rhs.GetX(i) || lhs.GetY(i) != rhs.GetY(i) ||
49 lhs.GetRawX(i) != rhs.GetRawX(i) || lhs.GetRawY(i) != rhs.GetRawY(i) ||
50 lhs.GetTouchMajor(i) != rhs.GetTouchMajor(i) ||
51 lhs.GetPressure(i) != rhs.GetPressure(i) ||
52 lhs.GetToolType(i) != rhs.GetToolType(i))
53 return false;
54 }
55
56 if (lhs.GetHistorySize() != rhs.GetHistorySize())
57 return false;
58
59 for (size_t h = 0; h < lhs.GetHistorySize(); ++h) {
60 if (lhs.GetHistoricalEventTime(h) != rhs.GetHistoricalEventTime(h))
61 return false;
62
63 for (size_t i = 0; i < lhs.GetPointerCount(); ++i) {
64 if (lhs.GetHistoricalX(i, h) != rhs.GetHistoricalX(i, h) ||
65 lhs.GetHistoricalY(i, h) != rhs.GetHistoricalY(i, h) ||
66 lhs.GetHistoricalTouchMajor(i, h) !=
67 rhs.GetHistoricalTouchMajor(i, h))
68 return false;
69 }
70 }
71
72 return true;
73 }
74
75 bool operator!=(const MotionEvent& lhs, const MotionEvent& rhs) {
76 return !(lhs == rhs);
77 }
78
79 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698