summaryrefslogtreecommitdiffstats
path: root/chromium/ui/events/gestures/gesture_point.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/events/gestures/gesture_point.h')
-rw-r--r--chromium/ui/events/gestures/gesture_point.h47
1 files changed, 27 insertions, 20 deletions
diff --git a/chromium/ui/events/gestures/gesture_point.h b/chromium/ui/events/gestures/gesture_point.h
index 02aa4608592..f20cf9dc7ec 100644
--- a/chromium/ui/events/gestures/gesture_point.h
+++ b/chromium/ui/events/gestures/gesture_point.h
@@ -43,20 +43,22 @@ class GesturePoint {
bool IsInFlickWindow(const TouchEvent& event);
bool IsInHorizontalRailWindow() const;
bool IsInVerticalRailWindow() const;
- bool IsInsideManhattanSquare(const TouchEvent& event) const;
+ bool IsInsideTouchSlopRegion(const TouchEvent& event) const;
bool IsInScrollWindow(const TouchEvent& event) const;
bool BreaksHorizontalRail();
bool BreaksVerticalRail();
bool DidScroll(const TouchEvent& event, int distance) const;
- const gfx::Point& first_touch_position() const {
+ const gfx::PointF& first_touch_position() const {
return first_touch_position_;
}
double last_touch_time() const { return last_touch_time_; }
- const gfx::Point& last_touch_position() const { return last_touch_position_; }
- int x() const { return last_touch_position_.x(); }
- int y() const { return last_touch_position_.y(); }
+ const gfx::PointF& last_touch_position() const {
+ return last_touch_position_;
+ }
+ float x() const { return last_touch_position_.x(); }
+ float y() const { return last_touch_position_.y(); }
// point_id_ is used to drive GestureSequence::ProcessTouchEventForGesture.
// point_ids are maintained such that the set of point_ids is always
@@ -72,22 +74,25 @@ class GesturePoint {
bool in_use() const { return point_id_ >= 0; }
- gfx::Vector2d ScrollDelta();
+ gfx::Vector2dF ScrollDelta() const;
float XVelocity() { return velocity_calculator_.XVelocity(); }
float YVelocity() { return velocity_calculator_.YVelocity(); }
- const gfx::Rect& enclosing_rectangle() const { return enclosing_rect_; }
+ const gfx::RectF& enclosing_rectangle() const { return enclosing_rect_; }
+
+ void set_source_device_id(int source_device_id) {
+ source_device_id_ = source_device_id;
+ }
+ int source_device_id() const { return source_device_id_; }
private:
// Various statistical functions to manipulate gestures.
- // Tests if the point has a consistent scroll vector across a window of touch
- // move events.
- bool IsConsistentScrollingActionUnderway() const;
bool IsInClickTimeWindow() const;
bool IsInClickAggregateTimeWindow(double before, double after) const;
- bool IsPointInsideManhattanSquare(gfx::Point p1, gfx::Point p2) const;
+ bool IsPointInsideDoubleTapTouchSlopRegion(
+ gfx::PointF p1, gfx::PointF p2) const;
bool IsOverMinFlickSpeed();
// Returns -1, 0, 1 for |v| below the negative velocity threshold,
@@ -101,23 +106,23 @@ class GesturePoint {
// cleared on a ET_TOUCH_PRESSED event (i.e., at the beginning of a possible
// GESTURE_TAP event) or when Reset is called.
void UpdateEnclosingRectangle(const TouchEvent& event);
- void clear_enclosing_rectangle() { enclosing_rect_ = gfx::Rect(); }
+ void clear_enclosing_rectangle() { enclosing_rect_ = gfx::RectF(); }
// The position of the first touchdown event.
- gfx::Point first_touch_position_;
+ gfx::PointF first_touch_position_;
double first_touch_time_;
- gfx::Point second_last_touch_position_;
+ gfx::PointF second_last_touch_position_;
double second_last_touch_time_;
- gfx::Point last_touch_position_;
+ gfx::PointF last_touch_position_;
double last_touch_time_;
double second_last_tap_time_;
- gfx::Point second_last_tap_position_;
+ gfx::PointF second_last_tap_position_;
double last_tap_time_;
- gfx::Point last_tap_position_;
+ gfx::PointF last_tap_position_;
VelocityCalculator velocity_calculator_;
@@ -126,10 +131,12 @@ class GesturePoint {
// Represents the rectangle that encloses the circles/ellipses
// generated by a sequence of touch events
- gfx::Rect enclosing_rect_;
+ gfx::RectF enclosing_rect_;
+
+ int source_device_id_;
- // Count of the number of events with same direction.
- gfx::Vector2d same_direction_count_;
+ float max_touch_move_in_pixels_for_click_squared_;
+ float max_distance_between_taps_for_double_tap_squared_;
DISALLOW_COPY_AND_ASSIGN(GesturePoint);
};