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

Unified Diff: ui/events/gesture_detection/motion_event.cc

Issue 502993004: Remove abstract Clone and Cancel methods from MotionEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nasty bug fix Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/gesture_detection/motion_event.h ('k') | ui/events/gesture_detection/motion_event_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/motion_event.cc
diff --git a/ui/events/gesture_detection/motion_event.cc b/ui/events/gesture_detection/motion_event.cc
index 71a6912d06fc8f31d1fc35b56f5651018fc6a394..3c25a7af41bb0ac40a5d26ffafefc38717cfb29b 100644
--- a/ui/events/gesture_detection/motion_event.cc
+++ b/ui/events/gesture_detection/motion_event.cc
@@ -5,6 +5,7 @@
#include "ui/events/gesture_detection/motion_event.h"
#include "base/logging.h"
+#include "ui/events/gesture_detection/motion_event_generic.h"
namespace ui {
@@ -45,49 +46,12 @@ int MotionEvent::FindPointerIndexOfId(int id) const {
return -1;
}
-bool operator==(const MotionEvent& lhs, const MotionEvent& rhs) {
- if (lhs.GetId() != rhs.GetId() || lhs.GetAction() != rhs.GetAction() ||
- lhs.GetActionIndex() != rhs.GetActionIndex() ||
- lhs.GetPointerCount() != rhs.GetPointerCount() ||
- lhs.GetButtonState() != rhs.GetButtonState() ||
- lhs.GetEventTime() != rhs.GetEventTime() ||
- lhs.GetHistorySize() != rhs.GetHistorySize())
- return false;
-
- for (size_t i = 0; i < lhs.GetPointerCount(); ++i) {
- int rhsi = rhs.FindPointerIndexOfId(lhs.GetPointerId(i));
- if (rhsi == -1)
- return false;
-
- if (lhs.GetX(i) != rhs.GetX(rhsi) || lhs.GetY(i) != rhs.GetY(rhsi) ||
- lhs.GetRawX(i) != rhs.GetRawX(rhsi) ||
- lhs.GetRawY(i) != rhs.GetRawY(rhsi) ||
- lhs.GetTouchMajor(i) != rhs.GetTouchMajor(rhsi) ||
- lhs.GetTouchMinor(i) != rhs.GetTouchMinor(rhsi) ||
- lhs.GetOrientation(i) != rhs.GetOrientation(rhsi) ||
- lhs.GetPressure(i) != rhs.GetPressure(rhsi) ||
- lhs.GetToolType(i) != rhs.GetToolType(rhsi))
- return false;
-
- for (size_t h = 0; h < lhs.GetHistorySize(); ++h) {
- if (lhs.GetHistoricalX(i, h) != rhs.GetHistoricalX(rhsi, h) ||
- lhs.GetHistoricalY(i, h) != rhs.GetHistoricalY(rhsi, h) ||
- lhs.GetHistoricalTouchMajor(i, h) !=
- rhs.GetHistoricalTouchMajor(rhsi, h))
- return false;
- }
- }
-
- for (size_t h = 0; h < lhs.GetHistorySize(); ++h) {
- if (lhs.GetHistoricalEventTime(h) != rhs.GetHistoricalEventTime(h))
- return false;
- }
-
- return true;
+scoped_ptr<MotionEvent> MotionEvent::Clone() const {
+ return MotionEventGeneric::CloneEvent(*this);
}
-bool operator!=(const MotionEvent& lhs, const MotionEvent& rhs) {
- return !(lhs == rhs);
+scoped_ptr<MotionEvent> MotionEvent::Cancel() const {
+ return MotionEventGeneric::CancelEvent(*this);
}
} // namespace ui
« no previous file with comments | « ui/events/gesture_detection/motion_event.h ('k') | ui/events/gesture_detection/motion_event_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698