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

Side by Side Diff: ui/events/gestures/gesture_point.cc

Issue 103173004: Target touches to the correct display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset GR between test runs (caused local ASAN failure) Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/events/gestures/gesture_point.h ('k') | ui/events/gestures/gesture_recognizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/gestures/gesture_point.h" 5 #include "ui/events/gestures/gesture_point.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
11 #include "ui/events/event_constants.h" 11 #include "ui/events/event_constants.h"
12 #include "ui/events/gestures/gesture_configuration.h" 12 #include "ui/events/gestures/gesture_configuration.h"
13 #include "ui/events/gestures/gesture_types.h" 13 #include "ui/events/gestures/gesture_types.h"
14 #include "ui/events/gestures/gesture_util.h" 14 #include "ui/events/gestures/gesture_util.h"
15 15
16 namespace ui { 16 namespace ui {
17 17
18 GesturePoint::GesturePoint() 18 GesturePoint::GesturePoint()
19 : first_touch_time_(0.0), 19 : first_touch_time_(0.0),
20 second_last_touch_time_(0.0), 20 second_last_touch_time_(0.0),
21 last_touch_time_(0.0), 21 last_touch_time_(0.0),
22 second_last_tap_time_(0.0), 22 second_last_tap_time_(0.0),
23 last_tap_time_(0.0), 23 last_tap_time_(0.0),
24 velocity_calculator_( 24 velocity_calculator_(
25 GestureConfiguration::points_buffered_for_velocity()), 25 GestureConfiguration::points_buffered_for_velocity()),
26 point_id_(-1), 26 point_id_(-1),
27 touch_id_(-1) { 27 touch_id_(-1),
28 source_device_id_(-1) {
28 } 29 }
29 30
30 GesturePoint::~GesturePoint() {} 31 GesturePoint::~GesturePoint() {}
31 32
32 void GesturePoint::Reset() { 33 void GesturePoint::Reset() {
33 first_touch_time_ = second_last_touch_time_ = last_touch_time_ = 0.0; 34 first_touch_time_ = second_last_touch_time_ = last_touch_time_ = 0.0;
34 ResetVelocity(); 35 ResetVelocity();
35 point_id_ = -1; 36 point_id_ = -1;
36 clear_enclosing_rectangle(); 37 clear_enclosing_rectangle();
38 source_device_id_ = -1;
37 } 39 }
38 40
39 void GesturePoint::ResetVelocity() { 41 void GesturePoint::ResetVelocity() {
40 velocity_calculator_.ClearHistory(); 42 velocity_calculator_.ClearHistory();
41 same_direction_count_ = gfx::Vector2d(); 43 same_direction_count_ = gfx::Vector2d();
42 } 44 }
43 45
44 gfx::Vector2d GesturePoint::ScrollDelta() const { 46 gfx::Vector2d GesturePoint::ScrollDelta() const {
45 return last_touch_position_ - second_last_touch_position_; 47 return last_touch_position_ - second_last_touch_position_;
46 } 48 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 event.location().y() - radius, 223 event.location().y() - radius,
222 radius * 2, 224 radius * 2,
223 radius * 2); 225 radius * 2);
224 if (IsInClickWindow(event)) 226 if (IsInClickWindow(event))
225 enclosing_rect_.Union(rect); 227 enclosing_rect_.Union(rect);
226 else 228 else
227 enclosing_rect_ = rect; 229 enclosing_rect_ = rect;
228 } 230 }
229 231
230 } // namespace ui 232 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gestures/gesture_point.h ('k') | ui/events/gestures/gesture_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698