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

Side by Side Diff: ui/events/gesture_event_details.cc

Issue 1049383003: Postpone rail application for touch scrolling - chrome side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gesture_event_details.h" 5 #include "ui/events/gesture_event_details.h"
6 6
7 namespace ui { 7 namespace ui {
8 8
9 GestureEventDetails::GestureEventDetails() 9 GestureEventDetails::GestureEventDetails()
10 : type_(ET_UNKNOWN), touch_points_(0), oldest_touch_id_(-1) { 10 : type_(ET_UNKNOWN), touch_points_(0), oldest_touch_id_(-1) {
11 } 11 }
12 12
13 GestureEventDetails::GestureEventDetails(ui::EventType type) 13 GestureEventDetails::GestureEventDetails(ui::EventType type)
14 : type_(type), touch_points_(1), oldest_touch_id_(-1) { 14 : type_(type), touch_points_(1), oldest_touch_id_(-1) {
15 DCHECK_GE(type, ET_GESTURE_TYPE_START); 15 DCHECK_GE(type, ET_GESTURE_TYPE_START);
16 DCHECK_LE(type, ET_GESTURE_TYPE_END); 16 DCHECK_LE(type, ET_GESTURE_TYPE_END);
17 } 17 }
18 18
19 GestureEventDetails::GestureEventDetails(ui::EventType type, 19 GestureEventDetails::GestureEventDetails(ui::EventType type,
20 float delta_x, 20 float delta_x,
21 float delta_y,
22 ScrollRailState scroll_rail_state)
23 : type_(type), touch_points_(1), oldest_touch_id_(-1) {
24 switch (type_) {
25 case ui::ET_GESTURE_SCROLL_UPDATE:
26 data_.scroll_update.x = delta_x;
27 data_.scroll_update.y = delta_y;
28 data_.scroll_update.scroll_rail_state = scroll_rail_state;
29 break;
30
31 case ui::ET_SCROLL_FLING_START:
32 data_.fling_start.x = delta_x;
33 data_.fling_start.y = delta_y;
34 data_.fling_start.scroll_rail_state = scroll_rail_state;
35 break;
36
37 default:
38 NOTREACHED() << "Invalid event type for constructor: " << type;
39 }
40 }
41
42 GestureEventDetails::GestureEventDetails(ui::EventType type,
43 float delta_x,
21 float delta_y) 44 float delta_y)
22 : type_(type), touch_points_(1), oldest_touch_id_(-1) { 45 : type_(type), touch_points_(1), oldest_touch_id_(-1) {
23 DCHECK_GE(type, ET_GESTURE_TYPE_START);
24 DCHECK_LE(type, ET_GESTURE_TYPE_END);
25 switch (type_) { 46 switch (type_) {
26 case ui::ET_GESTURE_SCROLL_BEGIN: 47 case ui::ET_GESTURE_SCROLL_BEGIN:
27 data_.scroll_begin.x_hint = delta_x; 48 data_.scroll_begin.x_hint = delta_x;
28 data_.scroll_begin.y_hint = delta_y; 49 data_.scroll_begin.y_hint = delta_y;
29 break; 50 break;
30 51
31 case ui::ET_GESTURE_SCROLL_UPDATE:
32 data_.scroll_update.x = delta_x;
33 data_.scroll_update.y = delta_y;
34 break;
35
36 case ui::ET_SCROLL_FLING_START:
37 data_.fling_velocity.x = delta_x;
38 data_.fling_velocity.y = delta_y;
39 break;
40
41 case ui::ET_GESTURE_TWO_FINGER_TAP: 52 case ui::ET_GESTURE_TWO_FINGER_TAP:
42 data_.first_finger_enclosing_rectangle.width = delta_x; 53 data_.first_finger_enclosing_rectangle.width = delta_x;
43 data_.first_finger_enclosing_rectangle.height = delta_y; 54 data_.first_finger_enclosing_rectangle.height = delta_y;
44 break; 55 break;
45 56
46 case ui::ET_GESTURE_SWIPE: 57 case ui::ET_GESTURE_SWIPE:
47 data_.swipe.left = delta_x < 0; 58 data_.swipe.left = delta_x < 0;
48 data_.swipe.right = delta_x > 0; 59 data_.swipe.right = delta_x > 0;
49 data_.swipe.up = delta_y < 0; 60 data_.swipe.up = delta_y < 0;
50 data_.swipe.down = delta_y > 0; 61 data_.swipe.down = delta_y > 0;
(...skipping 29 matching lines...) Expand all
80 default: 91 default:
81 break; 92 break;
82 } 93 }
83 } 94 }
84 95
85 GestureEventDetails::Details::Details() { 96 GestureEventDetails::Details::Details() {
86 memset(this, 0, sizeof(Details)); 97 memset(this, 0, sizeof(Details));
87 } 98 }
88 99
89 } // namespace ui 100 } // namespace ui
OLDNEW
« ui/events/gesture_detection/gesture_provider.cc ('K') | « ui/events/gesture_event_details.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698