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

Unified Diff: content/common/input/touch_event_stream_validator.cc

Issue 1218663006: Use new WebTouchPoint field names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: content/common/input/touch_event_stream_validator.cc
diff --git a/content/common/input/touch_event_stream_validator.cc b/content/common/input/touch_event_stream_validator.cc
index 4c7598901dd2b1b145eeeaed55d014a5b956dc78..4d334811297fdb6df86005c2e1cde5b5b4d2eccb 100644
--- a/content/common/input/touch_event_stream_validator.cc
+++ b/content/common/input/touch_event_stream_validator.cc
@@ -19,7 +19,7 @@ namespace {
const WebTouchPoint* FindTouchPoint(const WebTouchEvent& event, int id) {
for (unsigned i = 0; i < event.touchesLength; ++i) {
- if (event.touches[i].id == id)
+ if (event.touches[i].pointerId == id)
return &event.touches[i];
}
return NULL;
@@ -30,7 +30,7 @@ std::string TouchPointIdsToString(const WebTouchEvent& event) {
for (unsigned i = 0; i < event.touchesLength; ++i) {
if (i)
ss << ",";
- ss << event.touches[i].id;
+ ss << event.touches[i].pointerId;
}
return ss.str();
}
@@ -74,11 +74,12 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
previous_point.state == WebTouchPoint::StateReleased)
continue;
- const WebTouchPoint* point = FindTouchPoint(event, previous_point.id);
+ const WebTouchPoint* point =
+ FindTouchPoint(event, previous_point.pointerId);
if (!point) {
error_msg->append(StringPrintf(
"Previously active touch point (id=%d) not in new event (ids=%s).\n",
- previous_point.id, TouchPointIdsToString(event).c_str()));
+ previous_point.pointerId, TouchPointIdsToString(event).c_str()));
}
}
@@ -86,14 +87,14 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
for (unsigned i = 0; i < event.touchesLength; ++i) {
const WebTouchPoint& point = event.touches[i];
const WebTouchPoint* previous_point =
- FindTouchPoint(previous_event, point.id);
+ FindTouchPoint(previous_event, point.pointerId);
// The point should exist in the previous event if it is not a new point.
if (!previous_point) {
if (point.state != WebTouchPoint::StatePressed)
error_msg->append(StringPrintf(
"Active touch point (id=%d) not in previous event (ids=%s).\n",
- point.id, TouchPointIdsToString(previous_event).c_str()));
+ point.pointerId, TouchPointIdsToString(previous_event).c_str()));
} else {
if (point.state == WebTouchPoint::StatePressed &&
previous_point->state != WebTouchPoint::StateCancelled &&
@@ -101,20 +102,21 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
error_msg->append(StringPrintf(
"Pressed touch point (id=%d) already exists in previous event "
"(ids=%s).\n",
- point.id, TouchPointIdsToString(previous_event).c_str()));
+ point.pointerId, TouchPointIdsToString(previous_event).c_str()));
}
}
switch (point.state) {
case WebTouchPoint::StateUndefined:
- error_msg->append(
- StringPrintf("Undefined touch point state (id=%d).\n", point.id));
+ error_msg->append(StringPrintf("Undefined touch point state (id=%d).\n",
+ point.pointerId));
break;
case WebTouchPoint::StateReleased:
if (event.type != WebInputEvent::TouchEnd) {
- error_msg->append(StringPrintf(
- "Released touch point (id=%d) outside touchend.\n", point.id));
+ error_msg->append(
+ StringPrintf("Released touch point (id=%d) outside touchend.\n",
+ point.pointerId));
} else {
found_valid_state_for_type = true;
}
@@ -122,8 +124,9 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
case WebTouchPoint::StatePressed:
if (event.type != WebInputEvent::TouchStart) {
- error_msg->append(StringPrintf(
- "Pressed touch point (id=%d) outside touchstart.\n", point.id));
+ error_msg->append(
+ StringPrintf("Pressed touch point (id=%d) outside touchstart.\n",
+ point.pointerId));
} else {
found_valid_state_for_type = true;
}
@@ -131,8 +134,9 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
case WebTouchPoint::StateMoved:
if (event.type != WebInputEvent::TouchMove) {
- error_msg->append(StringPrintf(
- "Moved touch point (id=%d) outside touchmove.\n", point.id));
+ error_msg->append(
+ StringPrintf("Moved touch point (id=%d) outside touchmove.\n",
+ point.pointerId));
} else {
found_valid_state_for_type = true;
}
@@ -145,7 +149,7 @@ bool TouchEventStreamValidator::Validate(const WebTouchEvent& event,
if (event.type != WebInputEvent::TouchCancel) {
error_msg->append(StringPrintf(
"Cancelled touch point (id=%d) outside touchcancel.\n",
- point.id));
+ point.pointerId));
} else {
found_valid_state_for_type = true;
}
« no previous file with comments | « content/common/input/synthetic_web_input_event_builders.cc ('k') | content/common/input/web_input_event_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698