summaryrefslogtreecommitdiffstats
path: root/ui/events/gestures
diff options
context:
space:
mode:
authortdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:10:18 +0000
committertdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:10:18 +0000
commit62cf1d7bea18a0e37faaf3cea0159aa9af6f7df3 (patch)
tree4e098d0993ddad6771279980333d2711bc63fee5 /ui/events/gestures
parent85c5dd305a8941e043a9fa4f48c5fb3eef98c759 (diff)
downloadchromium_src-62cf1d7bea18a0e37faaf3cea0159aa9af6f7df3.zip
chromium_src-62cf1d7bea18a0e37faaf3cea0159aa9af6f7df3.tar.gz
chromium_src-62cf1d7bea18a0e37faaf3cea0159aa9af6f7df3.tar.bz2
Replace touch_ids_bitfield_ with first_touch_id_.
touch_ids_bitfield was overcomplicated, and we never used anything except for the lowest touch id. BUG=366707 TEST=GestureRecognizerTest Review URL: https://codereview.chromium.org/344763003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/events/gestures')
-rw-r--r--ui/events/gestures/gesture_provider_aura.cc12
-rw-r--r--ui/events/gestures/gesture_recognizer_impl.cc2
-rw-r--r--ui/events/gestures/gesture_sequence.cc51
-rw-r--r--ui/events/gestures/gesture_sequence.h2
4 files changed, 26 insertions, 41 deletions
diff --git a/ui/events/gestures/gesture_provider_aura.cc b/ui/events/gestures/gesture_provider_aura.cc
index eb902f5..7485cda 100644
--- a/ui/events/gestures/gesture_provider_aura.cc
+++ b/ui/events/gestures/gesture_provider_aura.cc
@@ -61,6 +61,7 @@ void GestureProviderAura::OnTouchEventAck(bool event_consumed) {
void GestureProviderAura::OnGestureEvent(
const GestureEventData& gesture) {
GestureEventDetails details = gesture.details;
+ details.set_oldest_touch_id(gesture.motion_event_id);
if (gesture.type() == ET_GESTURE_TAP) {
int tap_count = 1;
@@ -77,18 +78,11 @@ void GestureProviderAura::OnGestureEvent(
}
scoped_ptr<ui::GestureEvent> event(
- new ui::GestureEvent(gesture.type(),
- gesture.x,
+ new ui::GestureEvent(gesture.x,
gesture.y,
last_touch_event_flags_,
gesture.time - base::TimeTicks(),
- details,
- // ui::GestureEvent stores a bitfield indicating the
- // ids of active touch points. This is currently only
- // used when one finger is down, and will eventually
- // be cleaned up. See crbug.com/366707.
- 1 << gesture.motion_event_id));
-
+ details));
ui::LatencyInfo* gesture_latency = event->latency();
diff --git a/ui/events/gestures/gesture_recognizer_impl.cc b/ui/events/gestures/gesture_recognizer_impl.cc
index e145334..38c07f8e 100644
--- a/ui/events/gestures/gesture_recognizer_impl.cc
+++ b/ui/events/gestures/gesture_recognizer_impl.cc
@@ -88,7 +88,7 @@ GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget(
GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent(
const GestureEvent& event) {
GestureConsumer* target = NULL;
- int touch_id = event.GetLowestTouchId();
+ int touch_id = event.details().oldest_touch_id();
target = touch_id_target_for_gestures_[touch_id];
return target;
}
diff --git a/ui/events/gestures/gesture_sequence.cc b/ui/events/gestures/gesture_sequence.cc
index 14824d0..8e2dc62 100644
--- a/ui/events/gestures/gesture_sequence.cc
+++ b/ui/events/gestures/gesture_sequence.cc
@@ -418,15 +418,6 @@ float BoundingBoxDiagonal(const gfx::RectF& rect) {
return sqrt(width + height);
}
-unsigned int ComputeTouchBitmask(const GesturePoint* points) {
- unsigned int touch_bitmask = 0;
- for (int i = 0; i < GestureSequence::kMaxGesturePoints; ++i) {
- if (points[i].in_use())
- touch_bitmask |= 1 << points[i].touch_id();
- }
- return touch_bitmask;
-}
-
const float kFlingCurveNormalization = 1.0f / 1875.f;
float CalibrateFlingVelocity(float velocity) {
@@ -880,15 +871,15 @@ GestureEvent* GestureSequence::CreateGestureEvent(
const gfx::PointF& location,
int flags,
base::Time timestamp,
- unsigned int touch_id_bitmask) {
+ int oldest_touch_id) {
GestureEventDetails gesture_details(details);
gesture_details.set_touch_points(point_count_);
gesture_details.set_bounding_box(bounding_box_);
+ gesture_details.set_oldest_touch_id(oldest_touch_id);
base::TimeDelta time_stamp =
base::TimeDelta::FromMicroseconds(timestamp.ToDoubleT() * 1000000);
- return new GestureEvent(gesture_details.type(), location.x(), location.y(),
- flags, time_stamp, gesture_details,
- touch_id_bitmask);
+ return new GestureEvent(location.x(), location.y(),
+ flags, time_stamp, gesture_details);
}
void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point,
@@ -898,7 +889,7 @@ void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point,
point.first_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::PrependTapCancelGestureEvent(const GesturePoint& point,
@@ -908,7 +899,7 @@ void GestureSequence::PrependTapCancelGestureEvent(const GesturePoint& point,
point.first_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::AppendBeginGestureEvent(const GesturePoint& point,
@@ -918,7 +909,7 @@ void GestureSequence::AppendBeginGestureEvent(const GesturePoint& point,
point.first_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::AppendEndGestureEvent(const GesturePoint& point,
@@ -928,7 +919,7 @@ void GestureSequence::AppendEndGestureEvent(const GesturePoint& point,
point.last_touch_position(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::AppendClickGestureEvent(const GesturePoint& point,
@@ -941,7 +932,7 @@ void GestureSequence::AppendClickGestureEvent(const GesturePoint& point,
center,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::AppendScrollGestureBegin(const GesturePoint& point,
@@ -953,7 +944,7 @@ void GestureSequence::AppendScrollGestureBegin(const GesturePoint& point,
location,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point,
@@ -980,14 +971,14 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point,
location,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
} else {
gestures->push_back(CreateGestureEvent(
GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0, 0),
location,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
}
@@ -1042,7 +1033,7 @@ void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
location,
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- ComputeTouchBitmask(points_)));
+ point.touch_id()));
}
void GestureSequence::AppendPinchGestureBegin(const GesturePoint& p1,
@@ -1054,7 +1045,7 @@ void GestureSequence::AppendPinchGestureBegin(const GesturePoint& p1,
center,
flags_,
base::Time::FromDoubleT(p1.last_touch_time()),
- 1 << p1.touch_id() | 1 << p2.touch_id()));
+ p1.touch_id()));
}
void GestureSequence::AppendPinchGestureEnd(const GesturePoint& p1,
@@ -1067,7 +1058,7 @@ void GestureSequence::AppendPinchGestureEnd(const GesturePoint& p1,
center,
flags_,
base::Time::FromDoubleT(p1.last_touch_time()),
- 1 << p1.touch_id() | 1 << p2.touch_id()));
+ p1.touch_id()));
}
void GestureSequence::AppendPinchGestureUpdate(const GesturePoint& point,
@@ -1080,7 +1071,7 @@ void GestureSequence::AppendPinchGestureUpdate(const GesturePoint& point,
bounding_box_.CenterPoint(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- ComputeTouchBitmask(points_)));
+ point.touch_id()));
}
void GestureSequence::AppendSwipeGesture(const GesturePoint& point,
@@ -1092,7 +1083,7 @@ void GestureSequence::AppendSwipeGesture(const GesturePoint& point,
bounding_box_.CenterPoint(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- ComputeTouchBitmask(points_)));
+ point.touch_id()));
}
void GestureSequence::AppendTwoFingerTapGestureEvent(Gestures* gestures) {
@@ -1105,7 +1096,7 @@ void GestureSequence::AppendTwoFingerTapGestureEvent(Gestures* gestures) {
point->enclosing_rectangle().CenterPoint(),
flags_,
base::Time::FromDoubleT(point->last_touch_time()),
- 1 << point->touch_id()));
+ point->touch_id()));
}
bool GestureSequence::Click(const TouchEvent& event,
@@ -1246,7 +1237,7 @@ void GestureSequence::AppendLongPressGestureEvent() {
point->first_touch_position(),
flags_,
base::Time::FromDoubleT(point->last_touch_time()),
- 1 << point->touch_id()));
+ point->touch_id()));
delegate_->DispatchPostponedGestureEvent(gesture.get());
}
@@ -1257,7 +1248,7 @@ void GestureSequence::AppendShowPressGestureEvent() {
point->first_touch_position(),
flags_,
base::Time::FromDoubleT(point->last_touch_time()),
- 1 << point->touch_id()));
+ point->touch_id()));
delegate_->DispatchPostponedGestureEvent(gesture.get());
}
@@ -1268,7 +1259,7 @@ void GestureSequence::AppendLongTapGestureEvent(const GesturePoint& point,
point.enclosing_rectangle().CenterPoint(),
flags_,
base::Time::FromDoubleT(point.last_touch_time()),
- 1 << point.touch_id()));
+ point.touch_id()));
}
bool GestureSequence::ScrollEnd(const TouchEvent& event,
diff --git a/ui/events/gestures/gesture_sequence.h b/ui/events/gestures/gesture_sequence.h
index 62676e9..3dd13fa 100644
--- a/ui/events/gestures/gesture_sequence.h
+++ b/ui/events/gestures/gesture_sequence.h
@@ -106,7 +106,7 @@ class EVENTS_EXPORT GestureSequence {
const gfx::PointF& location,
int flags,
base::Time timestamp,
- unsigned int touch_id_bitmask);
+ int oldest_touch_id);
// Functions to be called to add GestureEvents, after successful recognition.