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/gestures/gesture_point.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 8 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: ui/events/gestures/gesture_point.cc
diff --git a/ui/events/gestures/gesture_point.cc b/ui/events/gestures/gesture_point.cc
index 33966235a10fb0468d16dbbba964a3099d8eb869..2ffda38ee7da34e6daf6677d2e5fb0caa200f2d2 100644
--- a/ui/events/gestures/gesture_point.cc
+++ b/ui/events/gestures/gesture_point.cc
@@ -55,25 +55,25 @@ void GesturePoint::UpdateValues(const TouchEvent& event) {
const int64 event_timestamp_microseconds =
event.time_stamp().InMicroseconds();
if (event.type() == ui::ET_TOUCH_MOVED) {
- velocity_calculator_.PointSeen(event.location().x(),
- event.location().y(),
+ velocity_calculator_.PointSeen(gfx::ToFlooredPoint(event.location()).x(),
+ gfx::ToFlooredPoint(event.location()).y(),
event_timestamp_microseconds);
gfx::Vector2d sd(ScrollVelocityDirection(velocity_calculator_.XVelocity()),
ScrollVelocityDirection(velocity_calculator_.YVelocity()));
}
last_touch_time_ = event.time_stamp().InSecondsF();
- last_touch_position_ = event.location_f();
+ last_touch_position_ = event.location();
if (event.type() == ui::ET_TOUCH_PRESSED) {
ResetVelocity();
clear_enclosing_rectangle();
first_touch_time_ = last_touch_time_;
- first_touch_position_ = event.location();
+ first_touch_position_ = gfx::ToFlooredPoint(event.location());
second_last_touch_position_ = last_touch_position_;
second_last_touch_time_ = last_touch_time_;
- velocity_calculator_.PointSeen(event.location().x(),
- event.location().y(),
+ velocity_calculator_.PointSeen(gfx::ToFlooredPoint(event.location()).x(),
+ gfx::ToFlooredPoint(event.location()).y(),
event_timestamp_microseconds);
}
@@ -100,16 +100,16 @@ bool GesturePoint::IsInClickWindow(const TouchEvent& event) const {
bool GesturePoint::IsInDoubleClickWindow(const TouchEvent& event) const {
return IsInClickAggregateTimeWindow(last_tap_time_, last_touch_time_) &&
IsPointInsideDoubleTapTouchSlopRegion(
- event.location(), last_tap_position_);
+ gfx::ToFlooredPoint(event.location()), last_tap_position_);
}
bool GesturePoint::IsInTripleClickWindow(const TouchEvent& event) const {
return IsInClickAggregateTimeWindow(last_tap_time_, last_touch_time_) &&
IsInClickAggregateTimeWindow(second_last_tap_time_, last_tap_time_) &&
IsPointInsideDoubleTapTouchSlopRegion(
- event.location(), last_tap_position_) &&
+ gfx::ToFlooredPoint(event.location()), last_tap_position_) &&
IsPointInsideDoubleTapTouchSlopRegion(last_tap_position_,
- second_last_tap_position_);
+ second_last_tap_position_);
}
bool GesturePoint::IsInScrollWindow(const TouchEvent& event) const {
@@ -177,7 +177,7 @@ bool GesturePoint::IsInClickAggregateTimeWindow(double before,
}
bool GesturePoint::IsInsideTouchSlopRegion(const TouchEvent& event) const {
- const gfx::PointF& p1 = event.location();
+ const gfx::PointF& p1 = gfx::ToFlooredPoint(event.location());
const gfx::PointF& p2 = first_touch_position_;
float dx = p1.x() - p2.x();
float dy = p1.y() - p2.y();
@@ -218,8 +218,8 @@ void GesturePoint::UpdateEnclosingRectangle(const TouchEvent& event) {
else
radius = GestureConfiguration::default_radius();
- gfx::RectF rect(event.location_f().x() - radius,
- event.location_f().y() - radius,
+ gfx::RectF rect(event.location().x() - radius,
+ event.location().y() - radius,
radius * 2,
radius * 2);
if (IsInClickWindow(event))

Powered by Google App Engine
This is Rietveld 408576698